Structures (records)

uses System.SysUtils;

type
  //records cannot inherit and cannot
  //implement interfaces: for a shared
  //contract use classes
  TPoint = record
    X, Y: Integer;
    function ToText: string;
  end;

  //TPoint3D = record(TPoint) <- Error
  //end;

function TPoint.ToTextstring;
begin
  Result := Format('x = %d; y = %d', [X, Y]);
end;

var
  Point: TPoint;
begin
  Point.X := 2;
  Point.Y := 5;

  WriteLn(Point.ToText);
end.