10.8.1 Fully qualified names

王朝other·作者佚名  2006-01-10
窄屏简体版  字體: |||超大  

10.8.1 Fully qualified names

Every namespace and type has a fully qualified name, which uniquely

identifies the namespace or type

amongst all others. The fully qualified name of a namespace or type N is

determined as follows:

?If N is a member of the global namespace, its fully qualified name is N.

?Otherwise, its fully qualified name is S.N, where S is the fully

qualified name of the namespace or type

in which N is declared.

In other words, the fully qualified name of N is the complete hierarchical

path of identifiers that lead to N,

starting from the global namespace. Because every member of a namespace or

type must have a unique

name, it follows that the fully qualified name of a namespace or type is

always unique.

[Example: The example below shows several namespace and type declarations

along with their associated

fully qualified names.

class A {} // A

namespace X // X

{

class B // X.B

{

class C {} // X.B.C

}

namespace Y // X.Y

{

class D {} // X.Y.D

}

}

Chapter 10 Basic concepts

85

namespace X.Y // X.Y

{

class E {} // X.Y.E

}

end example]

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有  導航