Yeah, I know only the member method (not the member variable)could be overridden. However,the subclass does get a copy of member variable from the super class by inheritance. I guess my question would be:
when get runs. why it access the superclass member variable "difficultyLevel" instead of the subclass ones.
Joined: Feb 15, 2007
Now in you are in real soup.
A method in parent class(***not-over-ridden-in-child), How you can expect to access the state of child ?
*** Remember if you instantiate Child --> parent also gets instantiated.
Joined: Jul 17, 2007
Thanks for your help. I think I got the whole basic concept wrong. Inheritance is the logic concept which means there is not a physically a copy of whatever member variable or member methods. I guess the subclass just has the access to the superclass's methods or variables.
subject: **Inheritance and member variable question**