If you want to write only global namespace
instead of namespace
in your current location, put ::
at the beginning.
For example, if you have different Configuration
classes, then
class Configuration; // class 1 in the global namespace
namespace MyApp
{
class configuration; // class 1 and class 2 in different namespaces
function blah()
{
Configuration::doStuff(...) // MyApp::Configuration, class 2
::Configuration::doStuff(...) // top-level Configuration, class 1
}
}
Like this, when you're using the same name in another namespace
namespace
is used to limit
© 2024 OneMinuteCode. All rights reserved.