M Srinivasan wrote:but then ,
what if some methods in the base class are private , then they won't be available with the extended class.
How does it work in this scenario ? :rolleyes:
Does it really matter? Private methods are not accessable from outside the class, so it isn't defined as a required part of the class (its more implementation detail). Inheritance is about the subclass being able to behave as the base class -- it does not mean that it should have full access to the base class.
M Srinivasan wrote:thanks , i tried it out..
now , why is that a sub class reference can not point to a super class object, although super class will have the most of the methods that the sub class has .....
I think you need to take a step back, and examine OO concepts first. Trying to understand why references can refer to particular types of objects, and why, is a lot easier once you understand the theory first.
Henry