This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
Compiling and running this code prints: From SuperTest
Q. Can someone please explain why it prints "From SuperTest" and not "From SubTest" since the inherited instance method printa() is invoked on subclass reference type which I think should be considered for invoking the "redefined / redeclared" static method defined in the subclass??
Once you over ride the method printa() , the method a() in the sub class will get called from the subclass version of printa() . Else the method in the super class is called. So when the method is over ridden it prints "From SubTest".
Joined: May 16, 2006
Sorry, I meant to ask if you could elaborate on why it prints "From SuperTest" not "From SubTest". Can anyone tell me why?