Summary
You can define a class and place the definition of the class and the implementation of its member functions in separate files. You can then compile the class separately from any program that uses it, and you can use this same class in any number of different programs.
A namespace is a collection of name definitions, such as class definitions and variable declarations.
There are three ways to use a name from a namespace: by making all the names in the namespace available with a using directive, by making the single name available by a using declaration for the one name, or by qualifying the name with the name of the namespace and the scope resolution operator.
You place a definition in a namespace by placing the definition in a namespace grouping for that namespace.
The unnamed namespace can be used to make a name definition local to a compilation unit.