Computer Science, asked by SyedMalikahRizvi, 8 months ago

how virtual function can be used to implement the run time polymorphism explain with examples​

Answers

Answered by shahamrishu36
0

Answer:

The main use of virtual function is to achieve Runtime Polymorphism. Runtime polymorphism can be achieved only through a pointer (or reference) of base class type. Also, a base class pointer can point to the objects of base class as well as to the objects of derived class.

Answered by nagendra2717
0

Answer:

Virtual functions in C++ use to create a list of base class pointers and call methods of any of the derived classes without even knowing kind of derived class object. Virtual functions are resolved late, at runtime. ... Runtime polymorphism can be achieved only through a pointer (or reference) of base class type.

Similar questions