Classes

type
  TShape = class
  public
    LineCount: Integer;
    Name: string;
    constructor Create(ALineCount: Integer;
      const AName: string);
    function Clone: TShape;
  end;

constructor TShape.Create(ALineCount: Integer;
  const AName: string);
begin
  LineCount := ALineCount;
  Name := AName;
end;

//no built-in cloning: a copy method
//creates a new object from the fields
function TShape.CloneTShape;
begin
  Result := TShape.Create(LineCount, Name);
end;

var
  Square, SquareCopy: TShape;
begin
  Square := TShape.Create(4'Square');
  SquareCopy := Square.Clone;

  WriteLn('lineCount is ',
    SquareCopy.LineCount);
  WriteLn('name is ', SquareCopy.Name);
end.