Summary: In this tutorial, we will learn about Polymorphism in C++ with examples.

What is Polymorphism in C++?

Polymorphism is one of the properties of Object-Oriented Programming language.

Polymorphism according to the English dictionary means “the condition of occurring in several different forms”.

A Real-life Example of Polymorphism, a single person at the same time could be a father, a son, or an employee

Like wise in C++ we can achieve 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 and Function Overriding Post.

Leave a Reply