tw8150a.pp 400 B

12345678910111213141516171819202122232425262728293031323334353637
  1. {$ifdef fpc}
  2. {$mode delphi}
  3. {$endif}
  4. type
  5. tc = class
  6. a : longint;
  7. class procedure classmethod;
  8. procedure method;
  9. end;
  10. ttc = class of tc;
  11. var
  12. l : longint;
  13. class procedure tc.classmethod;
  14. begin
  15. if l <> 1 then
  16. halt(1);
  17. l := 2;
  18. end;
  19. procedure tc.method;
  20. begin
  21. end;
  22. var
  23. c: ttc;
  24. begin
  25. c := tc;
  26. l := 1;
  27. with c do
  28. classmethod;
  29. if l <> 2 then
  30. halt(2);
  31. end.