Chapter 16. Exploring Namespaces

<feature>
  • Learn what namespaces are and what they can do for you

  • See how to declare and define namespacess

  • Discover how to use unnamed namespaces

  • Learn about the using declaration and the using directive

  • Find out about namespace aliases and composite namespaces

  • Understand the global namespace

</feature>

What Is a Namespace?

A namespace is a C++ declaration area that lets you add a secondary name to an identifier, helping to ensure that no duplicate global identifier names exist in a program. The namespace is just a name that acts as a wrapper for the identifiers within it. Why would you need something like this in C++?

Namespace

A C++ declaration area that lets you add a secondary name to an identifier, helping to insure ...

Get Practical C++ now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.