pascalabcnet/TestSuite/opImplicit.pas

14 lines
243 B
ObjectPascal
Raw Permalink Normal View History

2020-08-01 16:04:54 +03:00
type
t1<T> = class
2021-01-06 22:47:39 +03:00
o: T;
constructor(o: T);
begin
self.o := o;
end;
static function operator implicit(o: T): t1<T> := new t1<T>(o);
2020-08-01 16:04:54 +03:00
end;
begin
var a: t1<string> := 'abcde';
2021-01-06 22:47:39 +03:00
Assert(a.o = 'abcde');
2020-08-01 16:04:54 +03:00
end.