In general, when regions are nested, any name declared in the inner region hides any objects with the same name in the outer region when this name is used in the inner region. Thus, in this case, when used in a class scope, names declared in the class will hide those that are declared in the enclosing namespace.
The external name is still available if you qualify it; in this case, being in the global namespace, it is available as ::foo .
Mike seymour
source share