| <<< Assignment operators | Index | Common uses of operators >>> |
If you have a copy constructor, you should have an operator=
Once you have operator=, a copy constructor is very simple:
class Rational {
public:
Rational( Rational const& other );
Rational& operator=( Rational const& other);
//...
};
Rational::Rational( Rational const& other )
{
*this = other;
}
| <<< Assignment operators | Index | Common uses of operators >>> |