C++细节学习之const对象只能调用const函数
来源:互联网 发布:旭辉研彩软件官网 编辑:程序博客网 时间:2024/06/13 00:44
const对象不能改变数据成员,所以不能调用非const函数;比如:
class Oneclass{ public: void ctfunc() const{} void uctfunc() {}}int onefunc(const Oneclass obj,const Oneclass *pointer,const Oneclass &reference){ obj.uctfunc(); //ok pointer->uctfunc(); //ok reference.ctfunc(); //ok obj.ctfunc(); //error pointer->ctfunc(); //error reference.ctfunc(); //error return 0;}
0 0
- C++细节学习之const对象只能调用const函数
- const 对象只能调用 const 函数
- const 对象只能调用const函数
- C++之const对象只能调用const成员函数---补充(18)《More Effective C++》
- 项目中的错误:const对象只能调用const函数
- const类型对象只能调用const类型函数
- [C++] const对象只能调用const方法的原因
- 为什么const对象只能调用const成员函数,而不能调用非const成员函数?
- 为什么const对象只能调用const成员函数,而不能调用非const成员函数?
- const对象调用非const成员函数
- 为什么const对象只能访问const成员函数
- 为什么const对象只能访问const成员函数
- C++const函数和const对象
- const成员函数和const对象的调用关系
- 非const对象也可以调用const成员函数
- 非const对象也可以调用const成员函数
- C++细节之const
- const对象与const函数
- CentOS 6.4中升级编译安装GCC 4.8.1 + GDB 7.6.1 + Eclipse 以及Kdump配置
- 分布式MySQL数据库TDSQL架构分析
- Spring mvc注解方式使用事务回滚
- Android进步之路四:SimpleAdapter类的具体用法
- 使用流畅的pdf分割软件
- C++细节学习之const对象只能调用const函数
- 从窗口到视口的映射
- Mac快捷键
- HITS(HITS(Hyperlink - Induced Topic Search) ) 算法
- 使用 Eclipse Memory Analyzer 进行堆转储文件分析
- Notification 的使用
- android自动弹出软键盘(输入键盘)
- mybatis执行批量更新batch update 的方法(oracle,mysql)
- 第一篇博客