.Methods access variables only in context of the class of the object they belong to
suggest the instance that actually executes m(), is an Instance of P (The superclass) but if it were an instance of P it would call P implementation of b() instead of Q implementation...(When an object is created, instances of all its super-classes are also created).
Originally posted by Mario Elkin Rodr�guez Alarc�n:
And don�t forget the ";" in anonymous classes .......
Originally posted by Claire Yang:
In the above program, class Q's instance variable b hide class P's b and class Q inherits m() method from class P, how to explain that when object q calls m() method, it doesn't "see" its own b but class P's b?