Polymorphism in C++


What is Polymorphism?

Practically it is using a function in many forms.

Poly means ‘many’
Morphism means ‘forms’ 
For ex:- 
‘+’ operator when used with number, performs arithmetic addition and when used with string operand, performs string concatenation.

Types of Polymorphism:

There are two types of Polymorphism:
•Compile time(Early Binding):Resolving type at compile time.
            Achieved by
                           Overloading function
                           Overloading operators
•Run time(Dynamic Binding or Late Binding): Resolving type at run time.
           Achieved by
                           Using inheritance and virtual functions


No comments:

Post a Comment