Key Concepts : What is Polymorphism?


Key Concept:

  • Polymorphism means that some code or operations or objects behave differently in different contexts.
  • Poly  - Means Many
  • Morphism Means Forms
  • Many Forms

Polymorphism

C++ supports several kinds of static (compile-time) and dynamic (run-time) polymorphisms. Compile-time polymorphism does not allow for certain run-time decisions, while run-time polymorphism typically incurs a performance penalty.

PolymorphismTypes:

  • Compile Time Polymorphism (Static Polymorphism)
  • Run Time Polymorphism (Dynamic Polymorphism)

Compile Time Polymorphism

  • Function Overloading
  • Operator Overloading

Run Time Polymorphism

  • Inheritance (Hybrid )
  • Virtual Member Functions