Mastering C++: A Comprehensive Quiz Based on 'Thinking in C++'

Disable ads (and more) with a membership for a one time $2.99 payment

Test your C++ skills with our quiz based on Bruce Eckel's 'Thinking in C++'. Dive into object-oriented programming, advanced topics, and fundamentals. Perfect for learners and experts alike. Assess your knowledge and become a C++ master!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


What must happen if a pure virtual function is not overridden in a derived class?

  1. The derived class becomes abstract

  2. Compilation error

  3. Run-time error

  4. The derived class is fine as is

The correct answer is: The derived class becomes abstract

When a pure virtual function is not overridden in a derived class, the derived class inherits the pure virtual function from its base class. Since the derived class does not provide an implementation for the pure virtual function, the derived class itself becomes an abstract class and cannot be instantiated. This means that any attempt to create an object of the derived class will result in a compilation error. Additionally, if the derived class is not made abstract by providing implementations for the pure virtual function, it will result in a run-time error when the program tries to access the pure virtual function through an object of the derived class. Therefore, the only correct option is A.