C++中如何正确使用const
来源:互联网 发布:揭阳华诺网络 编辑:程序博客网 时间:2024/05/19 10:08
这篇博客将会介绍在C++中如何正确使用const。
先摘录一段wikipedia中的代码:
void Foo( int * ptr, int const * ptrToConst, int * const constPtr, int const * const constPtrToConst ){ *ptr = 0; // OK: modifies the "pointee" data ptr = NULL; // OK: modifies the pointer *ptrToConst = 0; // Error! Cannot modify the "pointee" data ptrToConst = NULL; // OK: modifies the pointer *constPtr = 0; // OK: modifies the "pointee" data constPtr = NULL; // Error! Cannot modify the pointer *constPtrToConst = 0; // Error! Cannot modify the "pointee" data constPtrToConst = NULL; // Error! Cannot modify the pointer}
0 0
- C++中如何正确使用const
- C语言中正确使用const
- C/C++中const的正确使用
- 如何正确使用const,static,extern
- 如何正确使用const,static,extern
- 如何正确使用const,static,extern
- 如何正确使用const,static,extern
- 如何正确使用const、static、extern
- 如何正确使用const,static,extern
- 水滴石穿C语言之正确使用const
- C语言之正确使用const
- 水滴石穿C语言之正确使用const
- 水滴石穿C语言之正确使用const
- 水滴石穿C语言程序设计之正确使用const
- 水滴石穿C语言之正确使用const
- C语言之正确使用const
- c语言之正确使用const
- C语言之正确使用const
- 我的1314
- SQLServer 实用语法大全
- google 最佳实践 - ListView优化 (Making ListView Scrolling Smooth)
- SAP本地化-银企直连
- VS2010常用快捷键
- C++中如何正确使用const
- CSS属性选择器
- C++中的模板特化
- 小强的HTML5移动开发之路(9)——坦克大战游戏3
- Eclipse 配置安装 Flex 插件
- jQuery应用--$.post,$.get,$.getJSON提交方式
- iOS UIBezierPath类
- .net截取指定长度汉字超出部分以指定的字符代替
- UEditor jsp版上传图片自定义路劲配置