Submitted by: Niranjan.ambati
Polymorphic means many forms. The object of the polymorphic class pointer can store any derived class objects and called respective member functions when its object member functions is called automatically instead of calling base class member function.
By using "Virtual" key word in front of Base class member function, the base class become polymorphic class. when this member function assigns = 0 then it becomes pure virtual function and Base class become Abstract class.
The advantage of polymorphic class are
1. Late binding (run time)
2. It acts as interface between implementation and calling class.
3. The polymorphic class pointer can be assigned with array of derived class objects and called respective member functions.
4. Encapsulation can be achieved in the form of API (actual implementation).
Hope this explanation helps you.
Regards,
Niranjan Ambati
Above answer was rated as good by the following members:
es1968