Why in the next program the member function foo has priority over the global foo although the global one match the type?
#include
using name
In general, when scopes are nested, any name declared in the inner scope hides any entities with the same name in an outer scope when that name is used in the inner scope. So, in this case, when used in the class scope, names declared in the class will hide those declared in the enclosing namespace.
The outer name is still available if you qualify it; in this case, being in the global namespace, it's available as ::foo.