A pure virtual function is a virtual function in a C++ base class that has no implementation in the base class. It serves as a placeholder and forces derived classes to provide their own implementation.
A class that contains at least one pure virtual function is called an abstract class, and you cannot create an instance (object) of an abstract class.
The syntax for declaring a pure virtual function is to prepend the function declaration with thevirtual` keyword and append= 0` at the end.
Let's analyze the syntax of the options:
(A)void virtual show () = 0`: Thevirtual` keyword is in the wrong place. It should come before the return type.
(B)void show () virtual`: Thevirtual` keyword is in the wrong place.
(C)virtual void show () = 0`: This is the correct syntax. It starts with thevirtual` keyword, followed by the function signature (return type, name, parameters), and ends with= 0`.
(D)pure virtual void show ()`: The keywordpure` is not part of the syntax; the= 0` is what makes the virtual function pure.