使用命名空间,可以避免重名问题
例如:
#include<iostream> namespace a{ int x = 8; } namespace b{ int x = 9; } int main(){ int x = 10; std::cout << a::x << b::x << x << std::endl; return 0; }
使用命名空间,可以避免重名问题
例如:
#include<iostream> namespace a{ int x = 8; } namespace b{ int x = 9; } int main(){ int x = 10; std::cout << a::x << b::x << x << std::endl; return 0; }
转载于:https://www.cnblogs.com/cplusplus-study/p/4503046.html

被折叠的 条评论
为什么被折叠?