Please don't reprint this article; please don't re-publish in any form; please delete it within 24 hours of downloading this article; it is forbidden to use this article for commercial purposes.
3 Basic Concepts [Basic] 3.3 Declarative Regions and scopes [Basic.scope] 3.3.5 Namespace Scope [Basic.scope.namespace] 3 Basic Concepts [Basic] 3.3 Define Areas and Scope [Basic. Scope] 3.3.5 [basic space scope. scope. namespace] The declarative region of a namespace-definition is its namespace-body. The potential scope denoted by an original-namespace-name is the concatenation of the declarative regions established by each of the namespace -definitions in the same declarative region with that original-namespace-name. Entities declared in a namespace-body are said to be members of the namespace, and names introduced by these declarations into the declarative region of the namespace are said to be member names . of the namespace A namespace member name has namespace scope Its potential scope includes its namespace from the name's point of declaration (3.3.1) onwards;. and for each using-directive (7.3.4) that nominates the member's namespace, the member's Potential Scope Includes That Portion of The Potential Scope of the Using-Dire CTIVE That Follows The Member's Point of Declaration. [EXAMPLE: NAMESPACE N {INT I; INT G (INT A) {Return A;} int J (); void};} namespace {intl = 1;} // THE POTENTIAL Scope of L Is from Its Point of Declaration // To The End of The Translation Unit Namespace N {INT G (CHAR A) // OverLoads N :: g (int) {Return L a; // l is from Unnamed namespace} int i; // error: duplicate definition int j (); // ok: duplicate function declaration int j () // ok: definition of n :: j () {Return G (i);
// Calls n :: g (int)} int @ in/ t}} - the name space - the defined declaration area is its namespace. The potential scope indicated by an original-name space-name is made by the original-name space-name space-definition connection to each name space in the same declaration area. In the namespace - the entity declared in the body is called a member of the name space, which is introduced by the name of the name space. The namespace member name has a namespace scope. Its potential scope includes its name space starting from its name (3.3.1); and for each member's namespace (7.3.4), the potential scope of the member It also includes the potential scope of the USING-instruction after the declaration point of the member. [Example: Namespace N {INT I; INT G (INT A) {RETURN A;} int J (); Void Q ();} Namespace {INT L = 1;} // L Potential Domain from its declaration point / / The end of this translation unit NAMESPACE N {INT G (CHAR A) // Reserved N :: g (int) {RETURN L A; // L From Anonymous Name Space} INT i; // Error: Repeat Define int j (); // correct: Duplicate function declaration INT j () // correct: N :: j () definition {Return G (i); // Call N :: g (int)} int} ); // error: return type Different} - Case] a namespace member can also be Referred to after the :: scope resolution operator (5.1) Applied to the name of its namespace or the name of a namespace Which Nominates the Member's Namespace In a Using-Directive; See 3.4.3.2. Name Space Members can also nominate the namespace names of the name space in the name of the name space in the name of the name, named the name space of the name. The operator (5.1) is referred to.