how virtual function can be used to implement the run time polymorphism explain with examples
Answers
Answered by
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
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
English,
4 months ago
Computer Science,
4 months ago
History,
4 months ago
Math,
8 months ago
Math,
8 months ago
Political Science,
1 year ago
Political Science,
1 year ago