class Complex
{
Complex(double r=0,double i=0):real(r),imag(i){}
}
Complex Complex ::operator + (Complex &c)
{
Complex temp;
temp.real=real+c.real
temp.imag=imag+c.imag
return temp
}
Complex Complex ::operator + (Complex c)
{
real=c.real
imag=c.imag
return *this
}
本身 real 右边 c.real
新值 Complex temp
{
Complex(double r=0,double i=0):real(r),imag(i){}
}
Complex Complex ::operator + (Complex &c)
{
Complex temp;
temp.real=real+c.real
temp.imag=imag+c.imag
return temp
}
Complex Complex ::operator + (Complex c)
{
real=c.real
imag=c.imag
return *this
}
本身 real 右边 c.real
新值 Complex temp