In addition to assignment, we will now implement other auto assignment operators:
and with scalars:
This will require you to implement the following member functions:
class Interval {
public:
// Other member functions
Interval &operator=( Interval const &operand );
Interval &operator+=( Interval const &operand );
Interval &operator-=( Interval const &operand );
Interval &operator*=( Interval const &operand );
Interval &operator/=( Interval const &operand );
Interval &operator=( double s ); // Assigns this to [s, s]
Interval &operator+=( double s );
Interval &operator-=( double s );
Interval &operator*=( double s );
Interval &operator/=( double s );
Interval &operator++();
Interval operator++( int placeholder );
Interval &operator--();
Interval operator--( int placeholder );
};
Each of these will be in the form
Interval Interval::operator=( Interval const &operand ) {
left = operand.left;
right = operand.right;
return *this;
}