POLYMORPHISM IN C++


 Polymorphism 

Polymorphism is a feature of Object-Oriented Programming that allows one interface to be used for different data types or classes.

Polymorphism means “many forms”.

allows the same function name or operator to behave differently based on:

  • Number of arguments
  • Type of arguments
  • Object calling the function

 

Needs of Polymorphism

  • Improves code reusability
  • Reduces complexity
  • Supports dynamic behavior
  • Essential for real-world modeling
  • Makes programs flexible and extensible

Types of Polymorphism

Type

Also called

Achieved by

Compile-time Polymorphism

Static Binding

Function Overloading, Operator Overloading

Run-time Polymorphism

Dynamic Binding

Function Overriding using Virtual Functions


 

Post a Comment

0 Comments