C++ Polymorphism

tutorial and example
tutorial and example

Polymorphism is an important feature of object oriented programming. Polymorphism refers to “one name” “multiple forms”. Polymorphism means, a program contains same function name performs different functionality.

Polymorphism is classified into two types. These are:

  1. Compile time polymorphism
  2. Run time polymorphism

Compile time polymorphism: It is achieved by function overloading or operator overloading. This is also known as early binding or static binding.

Run time polymorphism: It is achieved by function overriding. This is also known as late binding or dynamic binding.

Simple example of polymorphism

A class ‘Polymorphism’ contains two functions with same name func.

Output: