Difference between revisions of "Self"
From Free Pascal wiki
Jump to navigationJump to searchLine 6: | Line 6: | ||
− | <syntaxhighlight> | + | <syntaxhighlight lang="pascal"> |
procedure TForm1.FormCreate(Sender: TObject); | procedure TForm1.FormCreate(Sender: TObject); | ||
begin | begin |
Revision as of 09:20, 30 June 2019
│
Deutsch (de) │
English (en) │
Esperanto (eo) │
suomi (fi) │
Self
is a keyword which can be used in instance methods to refer to the object on which the currently executing method has been invoked.
Reserved word self
used to represent an instance of the class in which it appears.
Self
can be used to access class members and as a reference to the current instance.
procedure TForm1.FormCreate(Sender: TObject);
begin
// Self stands for the TForm1 class in this example
Self.Caption := 'Test program';
Self.Visible := True;
end;