{$MODE OBJFPC}
type
  TFTest = class
    B: string;
    function Add(S: string = ''): TFTest;
    constructor Create(T: TFTest); overload;
  end;

function TFTest.Add(S: string): TFTest;
begin
  B := B + S;
  Exit(Self);
end;

var
  A: TFTest;

constructor TFTest.Create(T: TFTest);
begin
  B := T.B;
end;

begin
  writeln(TFTest.Create.Add('0')
    .Create((TFTest.Create(TFTest.Create(((((((TFTest.Create(TFTest.Create).Add('0')).Add('1').Create.Add('2')
    .Add as TObject).Create) as TFTest.ClassParent) as TFTest).Create).Add('3')).Add.Add('4').Create).Add('5')).Add('6')
    ).Add('7').B);
  readln;

end.