What are namespaces?

A namespace is a declarative region that can be used to package names, improve program readability, and reduce name clashes in the global namespace. It is an elegant alternative to using prefixes to indicate the sources of names.
For example:
namespace MyNamespace{
class Manager{ <-- 1
// ...
};
class Secretary{ <-- 2
// ...
};
void compute() <-- 3
{
// ...
}
// Other declarations for MyNamespacego in here
}
Namespaces facilitate building large systems by partitioning names into logical groupings. Namespaces are "open" and can be added to at different places. For most situations, this incremental approach is probably a better alternative than trying to specify all of the names in one location, and this approach is used heavily in the standard library. Namespaces can be nested if desired. Java has a concept similar to namespaces called packages.