I'm writing a Cairo app and when I couldn't compare PointD's (2D point with doubles) I thought I had to add an equals extension method because == couldn't be used, but then discovered that it already has an equals so that the equals here works, but the == doesn't.
- Code: Select all
use Cairo from Mono.Cairo
class Program
def main
assert PointD(1, 2).equals(PointD(1, 2))
assert PointD(1, 2) == PointD(1, 2) # error: Operator "==" cannot be applied to operands of type "Cairo.PointD" and "Cairo.PointD"
I was under the impression that the equals() was used to implement the == and <>.
Can you explain what's going on?
Thanks,
Nev