Why is including “using namespace” into a header file a bad idea in C++?
Consider this program: line# 1 #include <string> 2 3 using namespace std; 4 5 struct string { const char* p; }; // Beware: another string! 6 7 int main() 8 { 9 string x; // Error: ambiguous – which string is wanted? 10 } If you try to compile it, you’ll see errors: g++ using.cc … Read more