Skip to content

Instantly share code, notes, and snippets.

@hydai
Created February 28, 2016 09:58
Show Gist options
  • Save hydai/0a7c00de2bf0c79c0dce to your computer and use it in GitHub Desktop.
Save hydai/0a7c00de2bf0c79c0dce to your computer and use it in GitHub Desktop.
#include <iostream>
namespace A {
int x = 1;
}
namespace B {
int x = 2;
}
using namespace A;
using namespace B;
int main() {
// 因為同時混用 using namespace A, B 這邊的 x 會不知道是哪一個的 x 所以會出問題.
std::cout << x << " " << x << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment