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 can potentially happen if the signature of a redefined member function in a derived class changes from the base class version?

  1. It creates a new function

  2. It overloads the existing function

  3. It hides the base class version

  4. Nothing specific

The correct answer is: It hides the base class version

When the signature of a redefined member function in a derived class changes from the base class version, a new function is not created and it does not overload the existing function. Instead, it hides the base class version, meaning that the base class function cannot be accessed through an object of the derived class unless it is explicitly specified. This can potentially lead to unexpected behavior, as the derived class function may have different functionality than the base class function. Changing the signature of a redefined member function in a derived class should be done with caution and careful consideration of the potential impact on the code.