java缺陷:"覆盖"私有方法[Java编程思想]
程序员文章站
2022-06-07 21:15:35
...
package ploymorphism; import static net.mindview.util.Print.*; public class PrivateOverride { private void f() { print("private f()"); } public static void main(String[] args) { PrivateOverride po = new Derived(); po.f(); } } class Derived extends PrivateOverride { public void f() { print("public f()"); } } //output: //private f();