Object-Oriented Programming
What Is Polymorphism in OOP?
Polymorphism lets objects of different classes respond to the same method call in their own way, through one shared interface.
Definition
Polymorphism means "many forms". In object-oriented code it lets you call the same method on different kinds of objects and have each one respond in its own way.
A program can hold a list of shapes and call area() on each one without knowing whether a given shape is a circle or a square.
How it works
Runtime polymorphism comes from method overriding: a subclass redefines a method of its parent, and the version that runs is chosen by the object’s actual class.
Compile-time polymorphism comes from method overloading in languages such as Java and C#: several methods share a name but take different parameters.