Self: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Self
| Old | New | Line | |
|---|---|---|---|
| 1 | + | `Self` is a [[Keyword|keyword]] which can be used in instance [[Method|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|class]] in which it appears. `Self` can be used to access class members and as a reference to the current instance. | |
| 2 | + | ||
| 3 | + | ``` pascal | |
| 4 | + | procedure TForm1.FormCreate(Sender: TObject); | |
| 5 | + | begin | |
| 6 | + | // Self stands for the TForm1 class in this example | |
| 7 | + | Self.Caption := 'Test program'; | |
| 8 | + | Self.Visible := True; | |
| 9 | + | end; | |
| 10 | + | ``` | |
| 11 | + | ||
| 12 | + | --- | |
| 13 | + | *From the Free Pascal wiki, page "Self", as it stood on 2020-09-04 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
