#include <iostream>
using namespace std;
// 第一个命名空间
namespace first_space{
void func(){
cout << "Inside first_space" << endl;
}
}
// 第二个命名空间
namespace second_space{
void func(){
cout << "Inside second_space" << endl;
}
}
namespace Print{
void print(){
cout << " " << endl;
}
template <typename T>
void print(T const& a){
cout << a << endl;
}
}
using namespace Print;
int main ()
{
// 调用第一个命名空间中的函数
first_space::func();
// 调用第二个命名空间中的函数
second_space::func();
print();
print(10);
return 0;
}
06-28
225
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)