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 approach is advised against in altering namespaces in header files?

  1. Using using declarations

  2. Declaring new namespaces

  3. Using global using directives

  4. Both A and C

The correct answer is: Both A and C

Both A and C are advised against in altering namespaces in header files. Using using declarations, which bring in a single name from a namespace, can lead to naming conflicts and confusion. Using global using directives, which bring in all names from a namespace, can also lead to conflicts and make code harder to read and maintain. Instead, it is recommended to use fully qualified names or aliases to explicitly specify the namespace for each name used in the code. Declaring new namespaces does not necessarily need to be avoided, but it should be done carefully and thoughtfully to avoid conflicts with existing namespaces.