depends
所在版块:社会百科 发贴时间:2004-12-29 05:25  评分:

用户信息
复制本帖HTML代码
高亮: 今天贴 X 昨天贴 X 前天贴 X 
from your words, should do it in this way.

double operator ^(double a, double b) {
return ...;
}

this might not work, because compiler may not be able to differetiate this with its normal meaning - Bitwise Exclusive OR Operator: ^. try it by yourself with the compiler.

Remember to do cast before the actual prarameter, or it will be just Bitwise Exclusive OR Operator if it happend both operands are of int type.
.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!

没有签名档是最酷的签名档~
 相关帖子 我要回复↙ ↗回到正文
hi, how to overload operators in C++? chancing   (157 bytes , 657reads )
operator's primitive meaning is not allowed to be changed.. hula   (88 bytes , 268reads )
--> icky   (52 bytes , 269reads )
^ is XOR, you can use another operator name for it icky   (0 bytes , 306reads )
depends xscheme   (422 bytes , 622reads )