Runtime polymorphism is also called as inclusion polymorphism. This is achieved through the use of virtual functions.
This is can be better explaned by the following example.
Assume that the Class A implements a virtual method M and clases B and C that are derived from A override the virtual method M. When B is cast to A, a call to the method M from A is dispatched to B. Similarly, when C is cast to A, a call to M is dispatched to C. The decision on exactly which method to call is delayed untill runtime.
Answered by
Madhurima
, an ibibo Master,
at
6:22 PM on July 07, 2008