class BaseClass {
private void f() {
System.out.println("Baseclass f()");
}
public static void main(String[] args) {
BaseClass dc = new DerivedClass();
dc.f();
}
}
class DerivedClass extends BaseClass {
public void f() {
System.out.println("DerivedClass f()");
}
}
In my opinion, the object dc refers to should have only one non-override method - public void f() method,which make it(the public method) invisible when refered to with BaseClass reference.Since the object dc referes to does not have the private void f() method either because the DeriverClass could not inherit the private method,how could the object dc refers to call method f()?
thanks.