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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.