One of the slides from the course taught me the following;
A superclass type can always be cast to the type of one of its subclasses. This is called “downcasting”.
The ultimate root class in Java is Object. An object of type Object can be downcast to any type (class) that descends from Object.
The ability of a class to be cast to the type of one of its subclasses or descendants is terms polymorphism.
No comments:
Post a Comment