2012年5月30日
摘要: 近期遇到一些困惑。行动的过程中瞻前顾后,不能酣畅淋漓。困惑是因为模糊,业余时间把这些东西搞清楚。1、类何时需要自己的析构函数? 当类的构造函数在执行过程中申请了一些资源,销毁类的对象时需要收回这些资源。 一个相当经典的例子:#include <iostream>using namespace std;class String{public:String(const char*str);~String();explicit String(const String&str);String&operator=(const String&str);private: 阅读全文
posted @ 2012-05-30 22:11 kunkka_ 阅读(332) 评论(0) 推荐(0) 编辑