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!

Practice this question and more.


In C++, what does the default access level of inherited members become if not specified?

  1. Public

  2. Private

  3. Protected

  4. Static

The correct answer is: Private

When specifying inheritance in C++, the default access level of all inherited members becomes "private" if not explicitly stated. This means that the inherited members will only be accessible within the class that they were inherited from, and not outside of it. This option is incorrect because specifying "private" as the default access level of inherited members is a unique feature of C++, and may not apply to other programming languages. Options A and C are incorrect because they are the possible access levels that can be explicitly specified in C++ when inheriting members, and are not the default. Option D is incorrect because "static" does not pertain to the access level of inherited members, but rather refers to a different concept in programming.