posted 17 years ago
Exactly!!!
I thought copy of public methods are made and put into subclasses. But it seems that when i call a certain inherited (non-overridden) method from a subclass, then the method of superclass is called and it operates on the variables of superclass only.
I think a major confusion is resolved.
Thanks.
But some confusion is still lying. What you are saying means the getCount method of superclass is being called and it gives me the value of int count that lies in superclass.
In the getCount method of superclass, i did
And when i call the getCount from subclass, system.out.println on first line tells me, that it has the object of subClass, and the second line prints the value of this.count (so it should be ,count of subclass, which doesnt actually exist)
which is actually the value of count in superclass.
[ December 04, 2006: Message edited by: Nitin Nigam ]