f******l 发帖数: 26 | 1 the operator "-" in
z= -x
and
z= x-y
are two different things, how to define them to make a difference? | f******l 发帖数: 26 | 2
found this: one operand or 2 operands will make the difference.
z= -x:
public operator-(Complex opr1)
{
return new Complex(-opr1.real, -opr1.imag);
}
public operator-(Complex opr1, Complex opr2)
{
return new Complex(opr1.real-opr2.real, opr1.imag-opr2.imag);
}
【在 f******l 的大作中提到】 : the operator "-" in : z= -x : and : z= x-y : are two different things, how to define them to make a difference?
|
|