T
trouble
Hi,
I have the following code, which is basically overloading + and += for
complex numbers. It works fine, but can someone tell me how to use the
overloaded + in the definition of += rather than write the function
from scratch?
Thanks,
Ciao.
//-----------------------------------------------------------------
inline Complex Complex:perator + (const Complex &right) const
{
Complex myComplex( real() + right.real(), imag() + right.imag());
return ( myComplex );
}
//-----------------------------------------------------------------
inline const Complex & Complex:perator += (const Complex &right)
{
m_dRe += right.real();
m_dIm += right.imag();
return ( *this );
}
//------------------------------------------------------------------
I have the following code, which is basically overloading + and += for
complex numbers. It works fine, but can someone tell me how to use the
overloaded + in the definition of += rather than write the function
from scratch?
Thanks,
Ciao.
//-----------------------------------------------------------------
inline Complex Complex:perator + (const Complex &right) const
{
Complex myComplex( real() + right.real(), imag() + right.imag());
return ( myComplex );
}
//-----------------------------------------------------------------
inline const Complex & Complex:perator += (const Complex &right)
{
m_dRe += right.real();
m_dIm += right.imag();
return ( *this );
}
//------------------------------------------------------------------