O'Reilly logo

Navigating C++ and Object-Oriented Design by Gail Anderson, Paul Anderson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

3.6. Namespaces

An earlier section (“Storage Classes” on page 124) explains scope rules for variables in C++. Program variables may be:

  1. Local (declared inside functions without static and exist in local stack frames)

  2. External static with file scope (declared outside functions with static)

  3. Global with program scope (declared outside functions without static)

  4. Internal static (declared inside functions with static and exist in the data area)

With program scope (3), separately compiled modules require access to function names, structures, and objects, often placed in global namespace. Global namespace includes all names from global declarations; that is, declarations appearing outside of function definitions. What is the proper way to deal with global ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required