Question 116Asked in BPSC TRE 1.0 (2023) Computer Science Class 11-12Which of the following can be used to create an abstract class in the C++ programming language?
- ABy using the pure virtual function in the class
- BBy declaring a virtual function in the base class
- CBy declaring the virtual keyword afterward the class declaration
- DMore than one of the above
- ENone of the above
Show answerHide answer
Correct answer: (A) By using the pure virtual function in the class
Explanation
A class becomes abstract when it has at least one pure virtual function, for example virtual void f() = 0;. Such a class cannot be instantiated.