Why is Self assignable in Delphi?

后端 未结 5 901
星月不相逢
星月不相逢 2021-01-04 02:17

This code in a GUI application compiles and runs:

procedure TForm1.Button1Click(Sender: TObject);
begin
  Self := TForm1.Create(Owner);
end;
<
5条回答
  •  轮回少年
    2021-01-04 02:51

    Maybe to allow passing to const or var parameters?

    It could be an artefact, since system doesn't have self anywhere on the left of := sign.

提交回复
热议问题