Syntax for Pure Virtual Function is ?

Answer : D. void virtual show()=0

Syntax for Pure Virtual Function is ?

A. virtual void show()==0

B. void virtual show()==0

C. virtual void show()=0

D. void virtual show()=0

Answer : B. virtual void show()==0

Explanation :

  • In C++, A pure virtual function or abstract function is a virtual function for which we don’t have implementation, we only declare it. A pure virtual function is declared by assigning 0 in declaration.


// An abstract class 
class Sample
    // Data members of class 
    // Pure Virtual Function 
    virtual void show() = 0; 
   /* Other members */
Leave a Reply

Your email address will not be published.