A reference variable is always of a single, unchangeable type, but it can refer to a subtype object.
A single object can be referred to by reference variables of many different types— as long as they are the same type or a supertype of the object.
The reference variable's type (not the object's type), determines which methods can be called!
Polymorphic method invocations apply only to overridden instance methods.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment