Constructor/ru: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Constructor/ru
| Old | New | Line | |
|---|---|---|---|
| 1 | + | [[Reserved word/ru|Зарезервированное слово]] **constructor** относится к [[object-oriented programming/ru|объектно-ориентированному программированию]]. Оно является [[Method/ru|методом]] для создания [[Class/ru|класса]], который создает объект класса. | |
| 2 | + | ||
| 3 | + | Пример: | |
| 4 | + | ||
| 5 | + | ``` pascal | |
| 6 | + | // определение класса | |
| 7 | + | type | |
| 8 | + | TKlasse = class | |
| 9 | + | end; | |
| 10 | + | ||
| 11 | + | var | |
| 12 | + | // объявление переменной типа класса | |
| 13 | + | clsKlasse: TKlasse; | |
| 14 | + | ||
| 15 | + | begin | |
| 16 | + | ... | |
| 17 | + | // создание класса | |
| 18 | + | clsKlasse := TKlasse.Create; | |
| 19 | + | ... | |
| 20 | + | end; | |
| 21 | + | ``` | |
| 22 | + | ||
| 23 | + | ## См. также | |
| 24 | + | ||
| 25 | + | - [[Destructor/ru|Destructor]] | |
| 26 | + | ||
| 27 | + | --- | |
| 28 | + | *From the Free Pascal wiki, page "Constructor/ru", as it stood on 2020-01-29 after a change by Bart, 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).* |
