摘要: 成员函数如果是const意味着什么?有两个流行概念:物理常量性和逻辑常量性。C++对常量性的定义采用的是物理常量性概念,即const 成员函数不可以更改对象内任何non-static成员变量。例如: 1 class CTextBlock 2 { 3 public: 4 ...... 5 st... 阅读全文
posted @ 2014-07-17 16:49 月轩 阅读(272) 评论(0) 推荐(0) 编辑
摘要: 1 class Widget{ 2 3 Widget(); //默认构造函数 4 5 Widget(const Widget& rhs); //复制构造函数 6 7 Widget& operator= (const Widget& rhs);//... 阅读全文
posted @ 2014-07-17 10:46 月轩 阅读(202) 评论(0) 推荐(0) 编辑