Formatting and check not assigning to self in operator=
parent
f21109960d
commit
6824a51d70
|
@ -111,11 +111,15 @@ bool Julian::operator<=(const Julian &date) const {
|
||||||
* assignment
|
* assignment
|
||||||
*/
|
*/
|
||||||
Julian& Julian::operator=(const Julian& b) {
|
Julian& Julian::operator=(const Julian& b) {
|
||||||
date_ = b.date_;
|
|
||||||
|
if (this != &b) {
|
||||||
|
date_ = b.date_;
|
||||||
|
}
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Julian& Julian::operator=(const double b) {
|
Julian& Julian::operator=(const double b) {
|
||||||
|
|
||||||
date_ = b;
|
date_ = b;
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
|
8
Julian.h
8
Julian.h
|
@ -24,10 +24,10 @@ public:
|
||||||
bool operator>=(const Julian &date) const;
|
bool operator>=(const Julian &date) const;
|
||||||
bool operator<=(const Julian &date) const;
|
bool operator<=(const Julian &date) const;
|
||||||
|
|
||||||
Julian& operator=(const Julian& b);
|
Julian & operator=(const Julian& b);
|
||||||
Julian& operator=(const double b);
|
Julian & operator=(const double b);
|
||||||
Julian operator+(const Timespan& b) const;
|
Julian operator+(const Timespan& b) const;
|
||||||
Julian operator-(const Timespan& b) const;
|
Julian operator-(const Timespan& b) const;
|
||||||
|
|
||||||
~Julian() {
|
~Julian() {
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue