in Others edited by
2,190 views
0 votes
0 votes

Runtime polymorphism can be achieved by:

  1. Accessing virtual function through the pointer of the base class
  2. Accessing virtual function through the object
  3. The derived class
  4. None of these
in Others edited by
2.2k views

1 Answer

0 votes
0 votes

Option A

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.

https://www.tutorialspoint.com/virtual-functions-and-runtime-polymorphism-in-cplusplus#:~:text=The%20main%20use%20of%20virtual,the%20objects%20of%20derived%20class.

Related questions