Syntax for Pure Virtual Function is ?



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.

Syntax

// An abstract class 
class Sample
{    
    // Data members of class 
public: 
    // Pure Virtual Function 
    virtual void show() = 0; 
    
   /* Other members */
};

Related Searches to Syntax for Pure Virtual Function is ?