Try to fix a clang missing assignment warning
This commit is contained in:
parent
d8c793f23f
commit
a7490404ba
@ -14,6 +14,12 @@ public:
|
|||||||
Person(const Person& rhs) : name_(rhs.name_), age_(rhs.age_) {}
|
Person(const Person& rhs) : name_(rhs.name_), age_(rhs.age_) {}
|
||||||
virtual ~Person();
|
virtual ~Person();
|
||||||
|
|
||||||
|
Person& operator=(const Person& rhs) {
|
||||||
|
name_ = rhs.name_;
|
||||||
|
age_ = rhs.age_;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
template <typename Writer>
|
template <typename Writer>
|
||||||
void Serialize(Writer& writer) const {
|
void Serialize(Writer& writer) const {
|
||||||
@ -107,6 +113,13 @@ public:
|
|||||||
Employee(const Employee& rhs) : Person(rhs), dependents_(rhs.dependents_), married_(rhs.married_) {}
|
Employee(const Employee& rhs) : Person(rhs), dependents_(rhs.dependents_), married_(rhs.married_) {}
|
||||||
virtual ~Employee();
|
virtual ~Employee();
|
||||||
|
|
||||||
|
Employee& operator=(const Employee& rhs) {
|
||||||
|
static_cast<Person&>(*this) = rhs;
|
||||||
|
dependents_ = rhs.dependents_;
|
||||||
|
married_ = rhs.married_;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
void AddDependent(const Dependent& dependent) {
|
void AddDependent(const Dependent& dependent) {
|
||||||
dependents_.push_back(dependent);
|
dependents_.push_back(dependent);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user