pascalabcnet/TestSuite/lambdas11.pas
Ivan Bondarev c3da960cbf #2135
2021-01-06 12:11:41 +01:00

18 lines
262 B
ObjectPascal

type
t1 = class
l: List<Action0> := new List<Action0>;
static procedure operator+=(a: t1; d: Action0);
begin
a.l.Add(d);
end;
end;
var i: integer;
begin
var a := new t1;
a += ()->Inc(i);
a.l[0]();
assert(i = 1);
end.