1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
{ %fail} program toperator10; {$mode delphi} type TFoo = record F: Integer; end; // don't allow class operator declaration outside the class class operator Add(A, B: TFoo): TFoo; begin Result.F := A.F + B.F; end; begin end.