기술 성공, 실패 기록소

What does a leading :: mean in “using namespace ::X” in C++ 본문

프로그래밍언어/C++

What does a leading :: mean in “using namespace ::X” in C++

sunlab 2020. 11. 3. 19:26
728x90

stackoverflow.com/questions/6790087/what-does-a-leading-mean-in-using-namespace-x-in-c/6790101

 

What does a leading :: mean in "using namespace ::X" in C++

can somebody explain me the difference between the following namespace usages: using namespace ::layer::module; and using namespace layer::module; What causes the additional :: before layer?

stackoverflow.com

stackoverflow.com/questions/4665264/the-namespace-starts-with-in-c

 

The namespace starts with :: in C++

Possible Duplicate: What's the purpose of a leading “::” in a C++ method call This gtest has the example code. ::testing::AssertionResult IsEven(int n) { if ((n % 2) == 0)

stackoverflow.com

 

제일 앞의 ::은 global namespace 라는 것을 의미한다.

'프로그래밍언어 > C++' 카테고리의 다른 글

열거형, enum  (0) 2020.11.03
구조체 생성자.  (0) 2020.11.03
구조체 structure  (0) 2020.11.03
namespace  (0) 2020.11.03
템플릿, template  (0) 2020.11.03