pascalabcnet/TestSuite/lambdas11.pas

18 lines
262 B
ObjectPascal
Raw Permalink Normal View History

2021-01-06 14:11:41 +03:00
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.