如果 C++ 中的命名空间被限定,这意味着什么::
?例如::testing::Test
.
::
是范围解析运算符。它始终意味着“在全局命名空间中搜索右侧的符号”。例如:
namespace testing {
int a = 1;
}
namespace foo {
namespace testing {
int a = 2;
}
int b = ::testing::a; // b has the value 1
int c = testing::a; // c has the value 2
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)