Tutorial Polymorphism In C++

Prasoon Arora

White Belt
C++ is an object oriented language which has features like inheritance, polymorphism and more. The word Poly stand for many and morph means form. C++ have the feature which allow us to use the same function or key to be used in different ways.
Let us take the example of plus "+":
This sign is used for adding two integers or to add two strings.
2+3=5
Prasoon+Arora= PrasoonArora
 

steve taylor

White Belt
Polymorphism means more than one form. With the help of Polymorphism properties of Object oriented programming we can perform different task by the single function. More than one task are performed by a single function by function overloading and operator overloading. Example :- We have a function of Draw shape,
With the help of draw shape function we can draw tangle, rectangle, Square etc
 

Manish Mishra

Content Writer
The practical benefits of the polymorphism is to avoid using multiple functions for similar tasks. It does help the lengthy codes to be shorter and make the program easier to read.
 

Doominic anderson

White Belt
Polymorphism is an object orient feature of C++ like inheritance,abstraction,encapsulation,classes and objects.
It means more than in one form,it is done by method overriding, when both super and subclass have member function with same declaration but with different definition.
It is done through function overloading and operator overloading,but it is not applied for all the operators,mainly it is applied for arithmetic operators.
 

justiinn

Well-Known Member
we all know that poly means more than one.
polymorphism is a feature of c++.c++ is an object oriented programming language and almost similar to c except oops concept.
polymorphism means more than one form that means you can perform more than one task from single function.
example of addition is good to explain polymorphism in a very easy way.
 

Swati Mishra

Content Writer
Polymorphism means having many forms polymorphism occurs when we use inheritance. Polymorphism is used when different classes with same function name and parameter are also same but implementation will differ.
 

Prasoon Arora

White Belt
Inheritance and Polymorsphism are related to each other and are the two most used features in C++.


Lets say, that there is a function created Draw(), which is used to draw the figure of given shape. Polymorphism is followed as any shape can be form using the same function draw() and at the same time, from the base class shape , with the function draw() is being further categorized to Triangle, Rectangle, Circle and can be refereed as inheritance function too.
 
Top