3 回答
TA贡献1943条经验 获得超7个赞
Configuration
class Configuration; // class 1, in global namespacenamespace MyApp{ class Configuration; // class 2, different from class 1 function blah() { // resolves to MyApp::Configuration, class 2 Configuration::doStuff(...) // resolves to top-level Configuration, class 1 ::Configuration::doStuff(...) }}
MyApp
.
TA贡献1829条经验 获得超7个赞
::
int count = 0;int main(void) { int count = 0; ::count = 1; // set global count to 1 count = 2; // set local count to 2 return 0;}
TA贡献1836条经验 获得超13个赞
::
/
/path/to/executable
::std::cout
PATH
PATH=/usr/bin:/usr/local/bin
/tmp
X11/xterm
/tmp/X11/xterm
/usr/bin/X11/xterm
/usr/local/bin/X11/xterm
X
using namespace Y
std::cout
::X::std::cout
, ::std::cout
, ::Y::std::cout
::std::cout
std
cout
std::cout
值得注意的差异:
PATH
.
PATH
.
/
PATH
).
关于名称空间与符号明示性的一般性讨论
::abc::def::...
std::
cout
merge
, includes
, fill
, generate
, exchange
, queue
, toupper
, max
using namespace
using namespace
::
- 3 回答
- 0 关注
- 342 浏览
添加回答
举报