Polymorphism in C++ | What is polymorphism | types of polymorphism


Polymorphism in C++

{tocify} $title={Table of Contents}

Polymorphism:-    

                                    The word 'polymorphism' means 'a state of having many shapes' or 'the capacity to take on different forms' or It is a greek term, that mean the ability to take more than one from. An operation may exhibit different behaviors in different instances. The behavior depend upon types of data used in a operation. For example, consider the operation of airthmetic.  For two numbers to perform a arithmetic operation, the operation will generate a third number. If the operands are strings, then the operation would produce a third string by concatenation.


Polymorphism in C++



The figure given blew illustrates that a single function name can be used to handle different number and different types of arguments. This is something similar to a particular word having several different meaning depending on the context.


Polymorphism in C++

                                  
                                     Fig:-Polymorphism 

 Polymorphism plays an important role in allowing objects having different internal structures to share the same external interface. This means that a general class of operations may be accessed in the same manner even though specific actions associated with each operation may differ. Polymorphism is extensively used in implementing inheritance.     

Data science & data analyst

C++

Algorithms

Technology





Post a Comment

Ask any query by comments

Previous Post Next Post