标签:style strong io art cti ar 代码 div
class Date{...}; class Customer { public: ... private: std::string name; Date lastTransaction; }; class PriorityCustomer:public Customer { public: PriorityCustomer(const PriorityCustomer& rhs); PriorityCustomer& operator=(const PriorityCustomer& rhs); ... private: int priority; }: PriorityCustomer::PriorityCustomer(const PriorityCustomer& rhs) :Customer(rhs),priority(rhs.priority) //调用base class的copy构造函数 {} PriorityCustomer& PriorityCustomer::operator = (const PriorityCustomer& rhs) { Customer::operator=(rhs); //对base class成分进行赋值动作 priority=rhs.priority; return *this; }
Effective C++读书笔记之十二:复制对象时勿忘其每一个成分,布布扣,bubuko.com
Effective C++读书笔记之十二:复制对象时勿忘其每一个成分
标签:style strong io art cti ar 代码 div
原文地址:http://blog.csdn.net/u013988279/article/details/38368327