| <<< lvalue explained | Index | operator= and copy constructor >>> |
Should return *this (by reference), to allow for assignment chaining.
Almost always needs to check for self assignment condition:
Rational& Rational::operator=( Rational const& other )
{
if ( this == &other ) // beware of self assignment!
return *this;
m_n = other.m_n;
m_d = other.m_d;
return *this;
}
| <<< lvalue explained | Index | operator= and copy constructor >>> |