#include using namespace std; void foo() { cout << "hello from global foo" << endl; } namespace A { void foo() { cout << "hello from A foo" << endl; } } namespace B { void foo() { cout << "hello from B foo" << endl; } } namespace C { void foo() { cout << "hello from C foo" << endl; } } // this will cause an "ambiguous overloaded function error" //using namespace B; int main() { foo(); }