Self

From Free Pascal wiki
Jump to navigationJump to search

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;