摘要: 拷贝构造、拷贝赋值以及析构函数:类带pointer一定要写拷贝构造和拷贝赋值 普通构造函数: inline string::string(const char* cstr=0){ if(cstr){ m_data=new char[strlen(cstr)+1];//strlen计算string长度 阅读全文
posted @ 2016-05-15 15:53 zhanghouyu 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 1.防卫式声明: 例: #ifndef ___COMPLEX___ #define ___COMPLEX___ ... #endif 2.内联函数:inline 函数是否真正为内联式函数,最终取决于编译器编译方式。 3.构造函数: 例: class complex{ public: complex( 阅读全文
posted @ 2016-05-15 09:49 zhanghouyu 阅读(140) 评论(0) 推荐(0) 编辑