Operator overloading

type
  TPoint = record
    X, Y: Integer;
    constructor Create(AXAYInteger);
    class operator Equal(
      const L, R: TPoint): Boolean;
    class operator NotEqual(
      const L, R: TPoint): Boolean;
  end;

constructor TPoint.Create(AXAYInteger);
begin
  X := AX;
  Y := AY;
end;

class operator TPoint.Equal(
  const L, R: TPoint): Boolean;
begin
  Result := (L.X = R.Xand (L.Y = R.Y);
end;

class operator TPoint.NotEqual(
  const L, R: TPoint): Boolean;
begin
  Result := not (L = R);
end;

var
  P1P2P3TPoint;
begin
  P1 := TPoint.Create(11);
  P2 := TPoint.Create(22);
  P3 := TPoint.Create(11);

  WriteLn('equal1 is 'P1 = P2);
  //equal1 is False

  WriteLn('equal2 is 'P1 = P3);
  //equal2 is True

  WriteLn('equal3 is 'P1 <> P3);
  //equal3 is False
end.