Suppose you have the following code
namespace a{
struct S{};
}
namespace b{
struct T{};
}
struct X{};
void f(X){}
void f(b::T){}
void f(a::S){}
namespace a{
void g(){
S s;b::T t;
X x;
f(x);
f(s);
f(t);
}
}
int main(){
a::g();
}
if void f(int){}defined in the namespace a (line 3 uncommented), it obscures the later definitions of void f(b::T){}and void f(a::S){}, but not void f(X){}. Why?
source
share