标签:
1 #include <iostream> 2 #include <string> 3 using namespace std; 4 5 void name() 6 { 7 cout << "name" << endl; 8 } 9 10 namespace aaa 11 { 12 void name() 13 { 14 cout << "aaa::name" << endl; 15 } 16 } 17 18 namespace bbb 19 { 20 void name() 21 { 22 cout << "bbb::name" << endl; 23 } 24 } 25 26 namespace ccc 27 { 28 namespace A 29 { 30 namespace B 31 { 32 void show(void){ 33 cout << "wo" << endl; 34 } 35 } 36 } 37 } 38 39 int main(){ 40 #if 0 41 aaa::name(); 42 using namespace aaa; 43 name(); 44 bbb::name(); 45 using bbb::name; 46 //using namespace bbb; 47 name(); 48 #endif 49 ccc::A::B::show(); 50 namespace ns = ccc::A; 51 ns::B::show(); 52 53 //ns = ccc::A::B; //error 54 //ns = ns::B;//error 55 56 namespace ns1 = ccc::A::B; 57 ns1::show(); 58 return 0; 59 }
标签:
原文地址:http://www.cnblogs.com/Neo-Lc/p/4873050.html