Created
February 28, 2016 09:58
-
-
Save hydai/0a7c00de2bf0c79c0dce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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