It is a bit like hiding, yes, only in reverse. The show() method belongs to class A and class B doesn't actually have a show() method. There is only a show() method in A so that is what the compiler will have gone for.
Joined: Jun 28, 2008
Thanks Campbell but y doesn't the compiler flag this as an error? As we all know,static method belongs to a class.In this case it belongs to class A,then how can we access it using the subclass(B)? And to be honest, i din get fred....
anything that is a 'B' IS-AN 'A'.
i guess here i m talking about something which belongs to A,so it might not belong to B.
Joined: Oct 13, 2005
Rules of inheritance: if "B extends A" then a "B" is-a[n] "A." We say inheritance implies an "IS-A" relationship.
The features of "A" (exception constructors) are repeated in "B."
Imaging you have Vehicle which is extended by Car. Then a Car IS-A Vehicle, and any features of Vehicle can reappear in Car.