type
TPoint = record
X, Y: Integer;
constructor Create(AX, AY: Integer);
class operator Equal(
const L, R: TPoint): Boolean;
class operator NotEqual(
const L, R: TPoint): Boolean;
end;
constructor TPoint.Create(AX, AY: Integer);
begin
X := AX;
Y := AY;
end;
class operator TPoint.Equal(
const L, R: TPoint): Boolean;
begin
Result := (L.X = R.X) and (L.Y = R.Y);
end;
class operator TPoint.NotEqual(
const L, R: TPoint): Boolean;
begin
Result := not (L = R);
end;
var
P1, P2, P3: TPoint;
begin
P1 := TPoint.Create(1, 1);
P2 := TPoint.Create(2, 2);
P3 := TPoint.Create(1, 1);
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.