Class Self reference |
Pas2JS pascal source code
type TMyObj = class function GetSelf: TMyObj; end; function TMyObj.GetSelf: TMyObj; begin Result := Self; end; { main.pas } var o = TMyObj.Create; Begin if o <> o.GetSelf then Writeln('bug'); WriteLn(o.GetSelf); { ### CONSOLE OUTPUTS ### {"ClassType":{"$ClassName":"TMyObj","$Parent":{"$ClassName":"TObject","$Parent":null}}} }