umshlp1.pp 610 B

1234567891011121314151617181920212223242526272829303132333435
  1. {$mode objfpc}
  2. {$modeswitch advancedrecords}
  3. {$modeswitch typehelpers}
  4. unit umshlp1;
  5. interface
  6. type
  7. TExtClassHelper = class helper for TObject
  8. procedure DoThisExt;
  9. end;
  10. TExtStringHelper = type helper for String
  11. function LengthExt: integer;
  12. end;
  13. TExtStringHelperMore = type helper for String
  14. function LengthTimesTwo: integer;
  15. end;
  16. implementation
  17. procedure TExtClassHelper.DoThisExt;
  18. begin
  19. end;
  20. function TExtStringHelper.LengthExt: integer;
  21. begin
  22. result := System.Length(self);
  23. end;
  24. function TExtStringHelperMore.LengthTimesTwo: integer;
  25. begin
  26. result := System.Length(self) * 2;
  27. end;
  28. end.