J
Jon Shemitz
Why aren't overloads of relational operators like <, ==, and >= not
restricted to returning a bool type? When would you EVER want == to
return, say, a double?
The best I can imagine, here, is that I might want to compare two
numbers for equality and get an Eta object that's basically the
difference between the two numbers. This Eta object could have an
implicit conversion to bool that would let A == B work, while at the
same time exposing methods like EqualWithIn(double Tolerance) - but
what I can't see is why I wouldn't, in this case, explicitly create an
Eta object ("new Eta(A, B)") and then call methods like Equals() or
Equals(double Tolerance) .
restricted to returning a bool type? When would you EVER want == to
return, say, a double?
The best I can imagine, here, is that I might want to compare two
numbers for equality and get an Eta object that's basically the
difference between the two numbers. This Eta object could have an
implicit conversion to bool that would let A == B work, while at the
same time exposing methods like EqualWithIn(double Tolerance) - but
what I can't see is why I wouldn't, in this case, explicitly create an
Eta object ("new Eta(A, B)") and then call methods like Equals() or
Equals(double Tolerance) .