Coupon Accepted Successfully!



One of the key features offered by C++ is polymorphisms. It is essential to know the concepts of polymorphisms and associated topics. In this chapter, we are going to learn and implement static (early) binding, dynamic (late) binding, polymorphisms, and virtual functions. An attempt is made to illustrate every point of this new topic in an easy way, and complicated subtopics are explained in a simple way.
The word poly means many, and morphism means several forms. Both the words are derived from Greek language. Thus, by combining these two words, a new whole word called polymorphism is created, which means various forms. We have learnt about overloading of functions and operators. It is also one type of polymorphism. The information pertaining to various overloaded member functions and arguments is known to the compiler while compiling. Thus, the compiler selects an appropriate function and collects the arguments at compile time. This is called early binding or static binding. This is also known as compile time polymorphism.
In C++, the function can be bound at either compile time or run time. Deciding a function call at compile time is called compile time or early or static binding. Deciding a function call at run time is called run time or late or dynamic binding. Dynamic binding permits to suspend the decision of choosing a suitable member function until run time. Two types of polymorphism are shown in Figure.

A polymorphism is a technique in which various forms of a single function can be defined and shared by various objects to perform an operation.


Fig: Polymorphisms in C++

Test Your Skills Now!
Take a Quiz now
Reviewer Name