ACtE03 · Chapter 3Programming & Applications🏛️ Past Licensure QuestionID: 1bff26a6
Which of the following statements about C++ pure virtual functions is correct?
Which of the following statements about C++ pure virtual functions is correct?
Multiple Choice Options
- A
They should be defined inside a base class
- B
Pure keyword should be used to declare a pure virtual function
- C✓ Correct Option
Pure virtual function is implemented in derived classes
- D
Pure virtual function cannot implemented in derived classes
Detailed Technical Solution & Explanation
A pure virtual function in C++ is declared in an abstract base class using the = 0 specifier: virtual void display() = 0;. It provides no implementation in the base class and obligates all concrete derived classes to provide their own implementation in order to be instantiated.
Option Analysis:
•
Option A (They should be defined inside a base ...): Incorrect. Pure virtual functions typically have no definition in the base class.
•
Option B (Pure keyword should be used to declar...): Incorrect. C++ has no
pure keyword; it uses the = 0 syntax.•
Option C (Pure virtual function is implemented ...): Correct. Concrete derived classes must override and implement pure virtual functions.
•
Option D (Pure virtual function cannot implemen...): Incorrect.
Reference: Mock Test 01NEC Licensure Syllabus