What does it mean if namespace in C++ is qualified with ::
? For example ::testing::Test
.
::
is the scope resolution operator. It always means "search the global namespace for the symbol on the right." For example:
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
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With