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 does C++ treat struct member functions compared to C in terms of scope?

  1. No difference, treated the same as in C

  2. They're scoped within the struct

  3. They're automatically global

  4. They're treated as private by default

The correct answer is: They're scoped within the struct

C++ treats struct member functions differently from C in terms of scope by scoping them within the struct. In contrast, in C the struct member functions would have no scoping and would behave the same as regular functions. Option A is incorrect because it is stated that there is a difference in scope between C++ and C. Option C is incorrect because member functions in C++ are not automatically global. Option D is incorrect because struct member functions in C++ are treated as public by default, not private.