What does this mean -> "Although a reference variable's type can't be changed, it can be used to refer to an object whose type is a subtype of its own" ?
Dreams are not which you see when you are asleep. Dreams are that that do not let you sleep..
Joined: Oct 13, 2005
You can have a reference to a Vehicle. You can use that reference to point to a Car object or a Bus object.
Joined: Feb 14, 2006
This is referring to inheritance. Consider the following example:
Taking your case, the Animal reference can be assigned to the Dog object, since it satisfies the IS A relationship. However, this fails for the second assignment since Shape doesn't extend Animal. Moreover, it shouldn't since they are not logically related.