return complex(a,b)和return (a,b)有什么区别定义一个complex类后 complex complex::operator+(complex c2) return complex(real+c2.real,imag+c2.imag)和return (real+c2.real,imag+c2.imag)为什么有区别?分别输出(6.5,12.5)和(12.5,0

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/15 00:15:29
return complex(a,b)和return (a,b)有什么区别定义一个complex类后 complex complex::operator+(complex c2) return complex(real+c2.real,imag+c2.imag)和return (real+c2.real,imag+c2.imag)为什么有区别?分别输出(6.5,12.5)和(12.5,0
xR[Kp*>*Y=Ȱ2eDe,*4#`R82WwZ! Kpp.s~‰ IȟK@*Eg!xS^{W&jk²g8nS 6ԫDA9) ECé(K5sOAwaM1TD[xi-gcll9HEs%_`ve į' 1'܀wwqq6`T|*SwQ*UN&!mxp >0J[

return complex(a,b)和return (a,b)有什么区别定义一个complex类后 complex complex::operator+(complex c2) return complex(real+c2.real,imag+c2.imag)和return (real+c2.real,imag+c2.imag)为什么有区别?分别输出(6.5,12.5)和(12.5,0
return complex(a,b)和return (a,b)有什么区别
定义一个complex类后
complex complex::operator+(complex c2)
return complex(real+c2.real,imag+c2.imag)和return (real+c2.real,imag+c2.imag)为什么有区别?分别输出(6.5,12.5)和(12.5,0)

return complex(a,b)和return (a,b)有什么区别定义一个complex类后 complex complex::operator+(complex c2) return complex(real+c2.real,imag+c2.imag)和return (real+c2.real,imag+c2.imag)为什么有区别?分别输出(6.5,12.5)和(12.5,0
return (a,b)等于return(b),这是逗号运算符的作用,不等于把a,b都返回回去.你可以找教科书上逗号运算符部分好好理解下
只有用return complex(a,b)才能构造合理的complex对象并返回