diff --git a/example/serialize/serialize.cpp b/example/serialize/serialize.cpp index cef5c66..a7f330e 100644 --- a/example/serialize/serialize.cpp +++ b/example/serialize/serialize.cpp @@ -14,6 +14,12 @@ public: Person(const Person& rhs) : name_(rhs.name_), age_(rhs.age_) {} virtual ~Person(); + Person& operator=(const Person& rhs) { + name_ = rhs.name_; + age_ = rhs.age_; + return *this; + } + protected: template void Serialize(Writer& writer) const { @@ -107,6 +113,13 @@ public: Employee(const Employee& rhs) : Person(rhs), dependents_(rhs.dependents_), married_(rhs.married_) {} virtual ~Employee(); + Employee& operator=(const Employee& rhs) { + static_cast(*this) = rhs; + dependents_ = rhs.dependents_; + married_ = rhs.married_; + return *this; + } + void AddDependent(const Dependent& dependent) { dependents_.push_back(dependent); }