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 happens if a derived class function does not override a virtual function from its base class?

  1. A compilation error

  2. The base class function is used

  3. The program crashes at runtime

  4. The derived class function becomes abstract

The correct answer is: The base class function is used

If a derived class function does not override a virtual function from its base class, the base class function is used. Virtual functions allow for polymorphism, where the same function can behave differently based on the type of object calling it. By not overriding the virtual function, the derived class is essentially inheriting and using the implementation from the base class. Hence, the correct answer is B.