Why is Self assignable in Delphi?
Posted
by mjustin
on Stack Overflow
See other posts from Stack Overflow
or by mjustin
Published on 2009-05-02T10:00:02Z
Indexed on
2010/03/30
11:33 UTC
Read the original article
Hit count: 508
This code in a GUI application compiles and runs:
procedure TForm1.Button1Click(Sender: TObject);
begin
Self := TForm1.Create(Owner);
end;
(tested with Delphi 6 and 2009)
- why is Self writeable and not read-only?
- in which situations could this be useful?
Edit:
- is this also possible in Delphi Prism? (I think yes it is, see here)
Update: Delphi applications/libraries which make use of Self assignment:
© Stack Overflow or respective owner