声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 2484|回复: 1

[C/C++] 请看看这个运算符重载有什么错误

[复制链接]
发表于 2006-5-29 19:33 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
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)请看看这个运算符重载有什么错误

数据类型不对
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-5-11 16:18 , Processed in 0.072931 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表