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
Consider what would happen if a global function declared somewhere in your code base (possibly several #include statements away) would trump an class obj member function declared right there in the class itself...
It would mean that, if you want to play it safe, you would have to fully qualify every single call to a member function...
this->foo();
...instead of having to qualify the less likely case of actually referring to the global function.
::foo();
This is called the "concept of least surprise".