Correct option is A
In C++, an abstract class is one that contains at least one pure virtual function. A pure virtual function is defined by assigning 0 to it in the function declaration. The correct way to declare an abstract class with a pure virtual function is:
class A {virtual void show() = 0; };
This syntax tells the compiler that “show” is a pure virtual function, making ‘A’ an abstract class that cannot be instantiated directly.
Information Booster:
1.
Abstract Class: An abstract class is a class that cannot be instantiated on its own. It requires at least one pure virtual function.
2.
Pure Virtual Function: A function declared by assigning 0 to the virtual function in a class, forcing derived classes to override it.
Additional Knowledge:
·
Option (b): Incorrect, as void show() = 0; lacks the virtual keyword.
·
Option (c): Incorrect, as it defines a concrete function { }; instead of a pure virtual function.
·
Option (d): Incorrect syntax as it lacks both virtual and a function body or assignment.