当涉及到继承时,派生类的赋值运算符也必须处理它的基类成员的赋值!否则,当派生类对象向另一个派生类对象赋值时,只有派生类部分赋值了.看看下面: class base { public: ): x(initialvalue) {} private: int x; }; class derived: public base { public: derived(int initialvalue) : base(initialvalue), y(initialvalue) {} derived& oper…