14. Namespaces

The year is 787!

A.D.?

– Monty Python

Composition Problems

Namespaces

Explicit Qualification; using-Declarations; using-Directives; Argument-Dependent Lookup; Namespaces Are Open

Modularization and Interfaces

Namespaces as Modules; Implementations; Interfaces and Implementations

Composition Using Namespaces

Convenience vs. Safety; Namespace Aliases; Namespace Composition; Composition and Selection; Namespaces and Overloading; Versioning; Nested Namespaces; Unnamed Namespaces; C Headers

Advice

14.1. Composition Problems

Any realistic program consists of a number of separate parts. Functions (§2.2.1, Chapter 12) and classes (§3.2, Chapter 16) provide relatively fine-grained separation of concerns, whereas “libraries,” ...

Get The C++ Programming Language, 4th Edition 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.