C C++ Java Data Structure Python JavaScript CSS Ajax PL/SQL PHP Puzzles C programs C++ programs Java programs

Home » C++ programming language

C++ polymorphism and its types

Learn: What is Polymorphism in C++ programming language, how many types of polymorphism C++ have?

Polymorphism is an important and basic concept of OOPS. Polymorphism specifies the ability to assume several forms. It allows routines to use variables of different types at different times.

In C++, An operator or function can be given different meanings or functions. Polymorphism refers to a single function or multi-functioning operator performing in different ways.

Types of polymorphism

There are two types of polymorphism in C++

  1. Static or Compile time polymorphism
  2. Dynamic or Run time polymorphism

1) Static or compile time polymorphism

In this type of polymorphism behavior of functions and operators decide at compile time. Thus, it is known as static or compile time polymorphism.

There are two types of static polymorphism:

2) Dynamic or run time polymorphism

Dynamic polymorphism is basically used for runtime time member function binding. Thus, it is known as dynamic polymorphism.

There are following types of dynamic polymorphism: