Constructor/es: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Constructor/es
| Old | New | Line | |
|---|---|---|---|
| 1 | + | La palabra reservada <b>constructor</b> es parte de la programación orientada a objetos y se utiliza para inicializar una clase. Las clases simples que no requieren inicialización, no necesitan un constructor. Una clase auto-escrita que no tiene ningún constructor puede heredar el constructor de su clase principal (si tiene un constructor). | |
| 2 | + | ||
| 3 | + | Ejemplo: | |
| 4 | + | ||
| 5 | + | ``` pascal | |
| 6 | + | // Definición de la calse | |
| 7 | + | type | |
| 8 | + | TClase = class | |
| 9 | + | end; | |
| 10 | + | ||
| 11 | + | var | |
| 12 | + | unaClase: TClase; // Declarar una variable del tipo TClase | |
| 13 | + | ||
| 14 | + | begin | |
| 15 | + | ... | |
| 16 | + | // Crear la clase | |
| 17 | + | unaClase := TClase.Create; // Create invoca al constructor heredado de la clase primaria | |
| 18 | + | ... | |
| 19 | + | end; | |
| 20 | + | ``` | |
| 21 | + | ||
| 22 | + | --- | |
| 23 | + | *From the Free Pascal wiki, page "Constructor/es", 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).* | |
| 24 | + | Category: Castellano | |
| 25 | + | Category: Español | |
| 26 | + | Category: Reserved words/es |
