Pure Virtual Function

A Pure Virtual Function is a Virtual function with no body.

Since pure virtual function has no body, the programmer must add the notation =0 for declaration of the pure virtual function in the base class.

class class_name //This denotes the base class of C++ virtual function


       public: 
               //This denotes the pure virtual  function in C++
               virtual void virtualfunctioname() = 0;

};

if the class is having at least one pure virtual functions,we can not create object for this class

No comments:

Post a Comment