Questions tagged «overriding»

5
覆盖具体方法是否有代码气味?
重写具体方法是否确实有代码异味?因为我认为您需要重写具体方法: public class A{ public void a(){ } } public class B extends A{ @Override public void a(){ } } 可以重写为 public interface A{ public void a(); } public class ConcreteA implements A{ public void a(); } public class B implements A{ public void a(){ } } 如果B要在A中重用a(),则可以重写为: public class …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.