2
0

tb0649.pp 755 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. { %NORUN }
  2. program tb0649;
  3. {$mode objfpc}
  4. type
  5. TEnum = (
  6. eOne,
  7. eTwo,
  8. eThree
  9. );
  10. TEnumSet = set of TEnum;
  11. TByteSet = set of Byte;
  12. TTest = class
  13. end;
  14. operator + (aLeft: TTest; aRight: array of Byte): TTest;
  15. begin
  16. Writeln('Array of Byte');
  17. Result := aLeft;
  18. end;
  19. operator + (aLeft: TTest; aRight: TByteSet): TTest;
  20. begin
  21. Writeln('Set of Byte');
  22. Result := aLeft;
  23. end;
  24. operator + (aLeft: TTest; aRight: array of TEnum): TTest;
  25. begin
  26. Writeln('Array of TEnum');
  27. Result := aLeft;
  28. end;
  29. operator + (aLeft: TTest; aRight: TEnumSet): TTest;
  30. begin
  31. Writeln('Set of TEnum');
  32. Result := aLeft;
  33. end;
  34. var
  35. t: TTest;
  36. begin
  37. t := t + [1, 2, 3];
  38. t := t + [eOne, eTwo];
  39. end.