InterviewSolution
Saved Bookmarks
| 1. |
What are virtual functions and pure virtual functions? |
|
Answer» A virtual function is a member function that is declared in a BASE class and overridden by a derived class. When we are using a pointer or a reference to the base class to refer to a derived class object, we can invoke a virtual function for that object and have it run the derived class's version of the function.
Functions that are only declared in the base class are known as pure virtual functions or abstract functions. This indicates that they have no definition in the base class and must be redefined in the subclass. |
|