Defining A namespace

From Appmethod Topics
Jump to: navigation, search

Go Up to C++ namespaces Index

The grammar for defining a namespace is

original-namespace-name:
	identifier
 namespace-definition:
	original-namespace-definition
	extension-namespace-definition
	unnamed-namespace-definition

Grammatically, there are three ways to define a namespace with the namespace keyword:

original-namespace-definition:
	namespace identifier { namespace-body }
extension-namespace-definition:
	namespace original-namespace-name { namespace-body }
unnamed-namespace-definition:
	namespace { namespace-body }

The body is an optional sequence of declarations. The grammar is

namespace-body:
	declaration-seq opt

See Also