Tuesday, 17 April 2012

What do you understand by a pure virtual member function? | C++

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.

No comments: