InterviewSolution
| 1. |
Write A Note About The Virtual Member Function? |
|
Answer» A virtual FUNCTION is a member function of the BASE class and relies on a specific object to determine which IMPLEMENTATION of the function is called. However, a virtual function can be declared a friend of ANOTHER class. If a function is declared virtual in a base class, you can still access it directly USING the :: operator. Note that if you do not override a virtual member function in a derived class, a call to that function uses the function implementation defined in the base class. A virtual function is a member function of the base class and relies on a specific object to determine which implementation of the function is called. However, a virtual function can be declared a friend of another class. If a function is declared virtual in a base class, you can still access it directly using the :: operator. Note that if you do not override a virtual member function in a derived class, a call to that function uses the function implementation defined in the base class. |
|