16.2.1-Word Space Declaration
The Declaration of the namespace is the keyword "namespace" followed by the name Space name and the namespace body, and then a semicolon can be followed. The format is as follows:
namespace Qualified-identifier namespace-body;
The Declaration of a namespace appears either in the first line of the compilation unit (the source file) or as a member in the Declaration of another namespace. The first-declared namespace is a member of the global namespace, and a namespace declared within another namespace as a member of the outer namespace. In either case, the name space does not allow duplicate names.
The namespace implicitly uses the public modifier, and any access modifiers are not allowed at the time of declaration.
The following form can implement nested declarations of namespaces using a nested syntax:
Namespace N1. N2
{
class a{}
class b{}
}
the above code is equivalent to:
namespace N1
{namespace N2 {
class A {}
Class b{}}}