Originally posted by jaspreet atwal:
Why cannot we assign an object of Superclass to a subclass? Shouldn't this work as subclass inherits all attributes of a superclass?
There is an "is a" relationship between subclasses and superclasses. An instance of a subclass
is an instance of the superclass. That is why you can assign an instance of a subclass to a variable of the superclass type - not the other way around!
[ November 06, 2007: Message edited by: Jesper Young ]