pascalabcnet/TestSuite/where8.pas

28 lines
431 B
ObjectPascal
Raw Permalink Normal View History

2019-06-11 16:43:27 +03:00
type
t0 = abstract class
function f0: integer; abstract;
end;
t1 = class(t0)
i: integer;
function f0: integer; override := i;
constructor(i: integer) := self.i := i;
end;
function f1<T>: T;
where T: t0;
begin
Result := T(t0(
new t1(10)
));
2019-10-04 14:37:47 +03:00
assert(Result.f0 = 10); // до #1986 было AccessViolationException
2019-06-11 16:43:27 +03:00
end;
begin
f1&<t1>;
// readln;
end.