关于namespace参考这个代码~
来源是百度百科namespace
#include <iostream> using namespace std; namespace savitch1 { void greeting( ); } namespace savitch2 { void greeting( ); } void big_greeting( ); int main( ) { savitch2::greeting( ); { using namespace savitch1; //使用savitch1、std、全局三个命名空间 greeting( ); } big_greeting( ); //使用了std一个标准命名空间 system("pause"); return 0; } namespace savitch1 { void greeting( ) { cout << "Hello from namespace savitch1.\n"; } } namespace savitch2 { void greeting() { cout << "Greetings from namespace savitch2.\n"; } } void big_greeting() { cout << "A Big Global Hello!\n"; }