This code in a GUI application compiles and runs (tested with Delphi 6 and 2009):

procedure TForm1.Button1Click(Sender: TObject);
begin
Self := TForm1.Create(Owner);
end;

Questions that come to mind:

  • why is Self writeable and not read-only?
  • in which situations could this be useful?

If you know the answer, I would be happy if you post it here or at stackoverflow.


Discover more from Habarisoft Blog

Subscribe to get the latest posts sent to your email.