pascalabcnet/TestSuite/extensionmethods22.pas

13 lines
234 B
ObjectPascal
Raw Permalink Normal View History

2017-09-11 22:06:16 +03:00
type BallInfo = class
x: integer;
end;
begin
var a : array of BallInfo;
a := new BallInfo[2](new BallInfo, new BallInfo);
var s := 0;
a[0].x := 1;
a[1].x := 2;
a.ForEach(x->begin s += x.x end);
assert(s = 3);
end.