InterviewSolution
| 1. |
What Do You Understand By A Pure Virtual Member Function? |
|
Answer» A virtual function with no body structure is called a pure virtual MEMBER function. You can declare a pure virtual member function by ADDING the notation =0 to the virtual member function declaration. For example, AREA () is a virtual function, but when it is DECLARED as shown in the FOLLOWING expression, it becomes a pure virtual member function: virtual int area () =0; To avoid a compilation error, all the classes need to implement pure virtual classes that are derived from the abstract class. A virtual function with no body structure is called a pure virtual member function. You can declare a pure virtual member function by adding the notation =0 to the virtual member function declaration. For example, area () is a virtual function, but when it is declared as shown in the following expression, it becomes a pure virtual member function: virtual int area () =0; To avoid a compilation error, all the classes need to implement pure virtual classes that are derived from the abstract class. |
|