码迷,mamicode.com
首页 > 编程语言 > 详细

C++下的命名空间

时间:2016-03-04 13:16:37      阅读:130      评论:0      收藏:0      [点我收藏+]

标签:

转自:http://blog.chinaunix.net/uid-24219701-id-2105573.html

实例:

 1 #include <iostream>
 2 using namespace std;
 3 
 4 namespace A{
 5     printA(){
 6         cout << "A / printA" << endl;
 7     }
 8 }
 9 
10 namespace B{
11     printB(){
12         cout << "B / printB" << endl;
13     }
14 }
15 
16 int main(){
17     A::printA();
18     B::printB();
19     return 0;
20 }

效果:

技术分享

C++下的命名空间

标签:

原文地址:http://www.cnblogs.com/yuwensong/p/5241676.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!