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.
You really should consider creating a more reasonable title, and placing the question in the body of the post, instead of the title....
any one give be the explanation for the code above and y it prints the output as pare
Overridding applies to methods -- not to instance variables. So, when you call the say() method, it will execute the latest version. This latest version is in the parent class, which at compile time was coded to access the instance variable of the parent.
Henry [ October 05, 2008: Message edited by: Henry Wong ]