23 Sept 2019

  • September 23, 2019
  • Amitraj


Polymorphism in C+
Polymorphism is a feature of OOPs that allows the object to behave differently in different conditions.

-> It is a Greek word. poly means many and  morphism means  forms.

-> polymorphism as the ability of a message to be displayed in more than one form.



Real life example of polymorphism,  A person at the same time can have different characteristic. Like a man at the same time is a father, a husband, an employee. So the same person posses different behavior in different situations. This is called polymorphism.


*Polymorphism is considered as one of the important features of Object Oriented Programming.


In C++ we have two types of polymorphism:
1) Compile time Polymorphism – This is also known as static (or early) binding.

2) Runtime Polymorphism – This is also known as dynamic (or late) binding.

Function overloading and Operator overloading are perfect example of Compile time polymorphism.









Translate

Popular Posts