Question 116Asked in BPSC TRE 1.0 (2023) Computer Science Class 11-12

Which of the following can be used to create an abstract class in the C++ programming language?

  1. ABy using the pure virtual function in the class
  2. BBy declaring a virtual function in the base class
  3. CBy declaring the virtual keyword afterward the class declaration
  4. DMore than one of the above
  5. 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.

From BPSC TRE 1.0 (2023) Computer Science Class 11-12 — Previous Year Paper

This is question 116 of BPSC TRE 1.0 (2023) Computer Science Class 11-12 — Previous Year Paper. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.