fork download
  1. {$MODE OBJFPC}
  2. type
  3. TFTest = class
  4. B: string;
  5. function Add(S: string = ''): TFTest;
  6. constructor Create(T: TFTest); overload;
  7. end;
  8.  
  9. function TFTest.Add(S: string): TFTest;
  10. begin
  11. B := B + S;
  12. Exit(Self);
  13. end;
  14.  
  15. var
  16. A: TFTest;
  17.  
  18. constructor TFTest.Create(T: TFTest);
  19. begin
  20. B := T.B;
  21. end;
  22.  
  23. begin
  24. writeln(TFTest.Create.Add('0')
  25. .Create((TFTest.Create(TFTest.Create(((((((TFTest.Create(TFTest.Create).Add('0')).Add('1').Create.Add('2')
  26. .Add as TObject).Create) as TFTest.ClassParent) as TFTest).Create).Add('3')).Add.Add('4').Create).Add('5')).Add('6')
  27. ).Add('7').B);
  28. readln;
  29.  
  30. end.
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Free Pascal Compiler version 2.2.0 [2009/11/16] for i386
Copyright (c) 1993-2007 by Florian Klaempfl
Target OS: Linux for i386
Compiling prog.pas
prog.pas(25,103) Error: identifier idents no member "Add"
prog.pas(25,106) Fatal: Syntax error, ")" expected but "(" found
Fatal: Compilation aborted
Error: /usr/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)
stdout
Standard output is empty