such example
program ovl_delphi;
{$ifdef fpc}
{$mode delphi}
{$endif}
type
TMyClass = record
FName: string;
constructor Create(const AName: string);
class operator Implicit(const AValue: string): TMyClass;
end;
{ TMyClass }
constructor TMyClass.Create(const AName: string);
begin
FName := AName;
end;
class operator TMyClass.Implicit(const AValue: string): TMyClass;
begin
Result := TMyClass.Create(AValue);
end;
var
c: TMyClass;
begin
c := 'hello';
end.
works fine both in FPC and Delphi,
but I need to implicitly create class (actually interface), not record. Delphi can't do that (well it can I guess in XE4 compiler based on LLVM)