请问这里namespace的作用是什么?
时间:2011-12-16
来源:互联网
namespace
{
bool fun1()
{
return 1;
};
bool fun2()
{
return 2;
};
}
请问这里namespace的作用是什么? 谢谢!
作者: hjh2005 发布时间: 2011-12-16
作者: qq120848369 发布时间: 2011-12-16
作者: mougaidong 发布时间: 2011-12-16
作者: pwy198407 发布时间: 2011-12-16
避免命名冲突的,相当于同一给每个标识的名字前面冠以前缀。
帅哥,没加前缀啊!
作者: hjh2005 发布时间: 2011-12-16
The use of the static keyword is deprecated when declaring objects in a namespace scope (see annex D);the unnamed-namespace provides a superior alternative.
就是说,未命名名字空间取代static
作者: yisikaipu 发布时间: 2011-12-16
ISO C++ 7.3.1.1
The use of the static keyword is deprecated when declaring objects in a namespace scope (see annex D);the unnamed-namespace provides a superior alternative.
就是说,未命名名字空间取代static
……
3Q ,遗憾的是英语太差,这句话看不懂呀! 哈哈
作者: hjh2005 发布时间: 2011-12-16
引用 5 楼 yisikaipu 的回复:
ISO C++ 7.3.1.1
The use of the static keyword is deprecated when declaring objects in a namespace scope (see annex D);the unnamed-namespace provides a superior alternative.……
就是匿名的名字空间,文件外部是不可以访问到的。因为没有名字。所以这样相当于是static 的效果。
作者: mingliang1212 发布时间: 2011-12-16
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28