namespace Declaration

A namespace declaration identifies and assigns a name to a declarative region.

Syntax

original-namespace-name :

identifier

namespace-definition :

original-namespace-definition
extension-namespace-definition
unnamed-namespace-definition

original-namespace-definition :

namespace identifier { namespace-body }

extension-namespace-definition :

namespace original-namespace-name { namespace-body }

unnamed-namespace-definition :

namespace { namespace-body }

namespace-body :

declaration-seqopt

The identifier in an original-namespace-definition must be unique in the declarative region in which it is used. The identifier is the name of the namespace and is used to reference its members. Subsequently, in that declarative region, it is treated as an original-namespace-name.

The declarative region of a namespace-definition is its namespace-body.

A namespace can contain data and function declarations. The declaration-seq is a list of these declarations which are said to be members of the namespace.