A program may include many identifiers defined in different scopes. Sometimes a variable of one scope will “overlap” (i.e., collide) with a variable of the same name in a different scope, possibly creating a naming conflict. Such overlapping can occur at many levels. Identifier overlapping occurs frequently in third-party libraries that happen to use the same names for global identifiers (such as functions). This can cause compilation errors.
C++ solves this problem with namespaces. Each
namespace defines a scope in which identifiers and variables are placed. To use a namespace member, either the member’s name must be qualified with the
namespace name and the scope resolution operator (::), as in
or a ...