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.


How can you access a base class function from a derived class when both classes have functions with the same name?

  1. Using the scope resolution operator

  2. By renaming the base class function

  3. By calling the derived class function only

  4. It is not possible

The correct answer is: Using the scope resolution operator

You can access a base class function from a derived class by using the scope resolution operator (:). This allows you to specify which class's function you want to use. Renaming the base class function is not necessary as long as you use the scope resolution operator. Only calling the derived class function will not give you access to the base class function. It is possible to access base class functions from a derived class, as long as you use the proper syntax. The correct way to do so is by using the scope resolution operator.