c++面向对象高级编程知识点(3)

1. 重载操作符 inline A& A::operator += (const A& r) { this->a = r.a; return this; } 2. 带指针的类,构造函数一定要自己写。用深拷贝,而不是浅拷贝。 class String { public: String(const char* cstr = 0); //带指针成员必须要有拷贝构造函数和拷
相关文章
相关标签/搜索