#include<iostream>
using namespace std;
namespace one//定义
{
const int M=200;
int inf=10;
}
namespace two
{
int x;
int inf=-100;
}
using namespace one;//using 声明使用一个完整的名字空间one
int main()
{
using two::x;//using 声明仅使用two中的x
x=-100;//直接访问,相当于two::x=-100
cout<<inf<<"\n";//直接使用one中的所以成员
cout<<M;
two::inf*=2;//使用名字空间名::局部内容名,操作未使用using声明的内容
cout<<"\n"<<x<<endl;//直接访问two中的x
}
using namespace std;
namespace one//定义
{
const int M=200;
int inf=10;
}
namespace two
{
int x;
int inf=-100;
}
using namespace one;//using 声明使用一个完整的名字空间one
int main()
{
using two::x;//using 声明仅使用two中的x
x=-100;//直接访问,相当于two::x=-100
cout<<inf<<"\n";//直接使用one中的所以成员
cout<<M;
two::inf*=2;//使用名字空间名::局部内容名,操作未使用using声明的内容
cout<<"\n"<<x<<endl;//直接访问two中的x
}