C++命名空间的用法

//#include <stdafx.h>
#include <cstdlib>
#include
<iostream>
using namespace std;

namespace anamespace
{
int x;
void SetX(int xvalue)
{

x
= xvalue;
cout
<<x<<endl;
}
};

namespace anothernamespace
{

int x;
void SetX(int xvalue)
{
x
= xvalue;
cout
<<x<<endl;

}
};

int main()
{
anamespace::SetX(
5);
anothernamespace::SetX(
10);
return 0;

}

原文地址:https://www.cnblogs.com/hnrainll/p/2047874.html