07 2014 档案

摘要:假设你建立一个class 用来保存一个指针指向一块动态分配的位图。1 class Bitmap {......};2 class Widget{3 ...4 private:5 Bitmap* pb ;6 };1 Widget& Widget::operator= (con... 阅读全文
posted @ 2014-07-20 17:01 月轩 阅读(299) 评论(0) 推荐(0)
摘要:成员函数如果是const意味着什么?有两个流行概念:物理常量性和逻辑常量性。C++对常量性的定义采用的是物理常量性概念,即const 成员函数不可以更改对象内任何non-static成员变量。例如: 1 class CTextBlock 2 { 3 public: 4 ...... 5 st... 阅读全文
posted @ 2014-07-17 16:49 月轩 阅读(283) 评论(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 月轩 阅读(212) 评论(0) 推荐(0)