This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
It is because the "start()" method is overriden in class tt. Remember, Invocation of instance methods are determined by the object referred to at runtime. So at runtime it is Class tt object.
If you use the syntax "((t)new tt()).variable", then it will invoke the variable of superclass and not that of subclass. Because the invocation of variables is determined at compile time and not at runtime.
Joined: Feb 28, 2007
I get it now that overriding method will be invoked and decided during runtime based on the object type, rather than the reference type.