pascalabcnet/TestSuite/implicitexplicit5.pas

14 lines
237 B
ObjectPascal
Raw Permalink Normal View History

2020-09-27 19:07:00 +03:00
type
t1 = class
i: object;
constructor(i: object);
begin
self.i := i;
end;
static function operator implicit<T>(val: T): t1 := new t1(val);
end;
begin
var a: t1 := 5;
assert(integer(a.i) = 5);
end.