shanghai 发表于 2006-5-29 19:33

请看看这个运算符重载有什么错误

complex complex::operator /(complex &amp;c)<BR>{<BR> complex temp;<BR> temp.m_fReal=(m_fReal*c.m_fReal+m_fImag*c.m_fImag)/(c.m_fReal*c.m_fReal+c.Imag*c.Imag);<BR> temp.m_fImag=(m_fImag*c.m_fReal-m_fReal*c.m_fImag)/(c.m_fReal*c.m_fReal+c.Imag*c.Imag);<BR> return temp;<BR>}<BR>编译时提示有如下错误:<BR>F:\DiagnosisSystem\complex.cpp(57) : error C2296: '*' : illegal, left operand has type 'double (__thiscall complex::*)(void)'<BR>F:\DiagnosisSystem\complex.cpp(57) : error C2297: '*' : illegal, right operand has type 'double (__thiscall complex::*)(void)'<BR>F:\DiagnosisSystem\complex.cpp(58) : error C2296: '*' : illegal, left operand has type 'double (__thiscall complex::*)(void)'<BR>F:\DiagnosisSystem\complex.cpp(58) : error C2297: '*' : illegal, right operand has type 'double (__thiscall complex::*)(void)'<BR>DiagnosisSystem.cpp<BR><BR>谢谢大家了!

风花雪月 发表于 2006-6-4 09:40

回复:(shanghai)请看看这个运算符重载有什么错误

数据类型不对
页: [1]
查看完整版本: 请看看这个运算符重载有什么错误