Object is of class C so C's g() is called(which is the one it inherits from B bcoz does not have it's own g()). Now this g() calls f(). Shouldn't it call C's f() because underlying object is C. Why does it call B's f() ?
posted 12 years ago
Notice that in class B the method f() is private. So C has not overridden B's f(). So in B's g() method, the call to method f() is its own private f().
Another thing to notice is that class A's f() method is private, so B and C can't use that method either.