using namespace X;
cout << var;
using Y::var;
cout << var;
So say I have a namespace X and a namespace Y that both contain a variable of type int called var. When I say using namespace X;
what I imagine happening is if I use some variable that isn't in the global namescope what basically happens is it goes okay I'm gonna look for var in namespace X
but now that I also use Y::var
what does this exactly mean? Does that just say var is the same as Y::var? But then in that case what's happening with using namespace X
does it not even look for var in there because I said I'm using Y::var
?