<分区>
Possible Duplicate:
Operator Overloading in C++ as int + obj
Operator overloading c++-faq
我有一个带有此运算符的 Point
对象:
Point operator +(float other) const {
return Point(x + other, y + other, z + other);
}
我可以像这样执行加法:
point + 10
但我不能以相反的顺序执行:
10 + point
是否需要重载另一个运算符才能提供此功能?