effective C++ 条款12 复制对象的时候勿忘其每一个成分

void logCall(const std:string &funcName);

class Customer {

  public:

  Customer(const Customer & rhs);

  Customer& operator =(const Customer &rhs);

  private:

  std:string name;

}

 

copying 函数确保复制对象内所有成员变量和所有base class成分。

不要尝试以某个copying函数实现另一个copying  函数,应该将共同技能放进第三个函数,两个copying函数共同调用。

 

posted on 2020-09-24 00:21  123_123  阅读(83)  评论(0编辑  收藏  举报