Possible Duplicate:
What's the purpose of a leading “::” in a C++ method call
This gtest has the example code.
::testing::Ass开发者_运维百科ertionResult IsEven(int n) {
if ((n % 2) == 0)
return ::testing::AssertionSuccess();
else
return ::testing::AssertionFailure() << n << " is odd";
}
How does it work? If the namespace is testing, isn't it testing::AssertionResult is the right usage?
The :: prefix refers to the global namespace, so this is like an absolute versus relative path specification.
精彩评论