c**********e 发帖数: 2007 | 1 When can binary operators be declared as member functions?
a) when the left argument of a binary operator is an object of that class.
b) when the right argument of a binary operator is an object of that class.
c) when both arguments of a binary operator is an object of that class. |
a****o 发帖数: 686 | 2 a)
【在 c**********e 的大作中提到】 : When can binary operators be declared as member functions? : a) when the left argument of a binary operator is an object of that class. : b) when the right argument of a binary operator is an object of that class. : c) when both arguments of a binary operator is an object of that class.
|
c**********e 发帖数: 2007 | 3 The answer is a). But why c) is not correct?
【在 a****o 的大作中提到】 : a)
|
M********5 发帖数: 715 | 4 c的限制太宽了
举一个很简单的例子,你定义一个BigInt,你的类应该是允许 BigInt + int的,而不
是只允许BigInt + BigInt的 |