Polymorphism is one of the features of Object Oriented Programming (OOPS). C++ being Object Oriented language supports polymorphism. So let’s learn about it.

What is Polymorphism in C++?

Polymorphism itself means “many forms”. In C++ we can achieve this ‘many forms’ thing i.e Polymorphism in two ways.

  1. Function Overloading – Static Polymorphism
  2. Function Overriding – Dynamic Polymorphism

What is Static Polymorphism?

This Polymorphism happens during the compilation of the program.

  • Implemented by Function Overloading.
  • Also known as Static linkage or early Binding.
  • The function call is associated with the function during compile time.

What is Dynamic Polymorphism?

This Polymorphism happens during the runtime of the program.

  • Implemented by Function Overriding ( with the use of Virtual Function ).
  • Also known as Dynamic linkage or late Binding.
  • The function call is associated with the function during Runtime.

For more depth details please visit Function overloading & Function Overriding Post.

 

Leave a Reply

Close Menu