uses System.SysUtils;
type
//记录不能继承,也不能实现接口:
//需要共享契约时应使用类
TPoint = record
X, Y: Integer;
function ToText: string;
end;
//TPoint3D = record(TPoint) <- Error
//end;
function TPoint.ToText: string;
begin
Result := Format('x = %d; y = %d', [X, Y]);
end;
var
Point: TPoint;
begin
Point.X := 2;
Point.Y := 5;
WriteLn(Point.ToText);
end.