Java Tutorial 65 - Inheritance 4/6 Polymorphism

preview_player
Показать описание
In this tutorial, I will show you what is Polymorphism. Polymorphism is from a Greek word meaning “many forms”. It means that a [object reference] variable of a supertype can refer to a subtype object.

For example, every undergraduate student is a student object, but not every student object is a undergraduate student. The method displayStudent takes a parameter of the Student type. An object of a subclass can be used wherever its superclass object is used. This is commonly known as polymorphism.
Рекомендации по теме