class Derived extends PrivateOverride{}
public class PrivateOverride{
private void f(){
System.out.println("private f()");
}
public static void main(String[] args){
PrivateOverride p=new Derived();
p.f();
}
}
/* output:
private f()
*/
想問的是 既然base class的f()是private
也就代表在Derived中看不到f()
那為什麼例子中卻可以執行出結果?
手機排版 請見諒