What is polymorphism?
What is polymorphism?
he word polymorphism means having many forms. In simple words, we can define polymorphism as the ability of a message to be displayed in more than one form.
Polymorphism is considered one of the important features of Object-Oriented Programming. Polymorphism allows us to perform a single action in different ways. In other words, polymorphism allows you to define one interface and have multiple implementations. The word “poly” means many and “morphs” means forms, So it means many forms.
Polymorphism is a feature of object-oriented programming languages that allows a specific routine to use variables of different types at different times. It is the ability of a programming language to present the same interface for several different underlying data types and different objects to respond in a unique way to the same message.
In Java polymorphism is mainly divided into two types:
- Compile-time Polymorphism
- Runtime Polymorphism
- 14 Forums
- 1,835 Topics
- 5,051 Posts
- 0 Online
- 1,078 Members