Sign in Join
Wiki copytemporary

Revision 1 of 3, by Bart on 1-29-2020. The page as it is now.

Constructor/es

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).

Ejemplo:

pascal
// Definición de la calse
type
  TClase = class
end;

var 
  unaClase: TClase; // Declarar una variable del tipo TClase

begin
  ...
  // Crear la clase
  unaClase := TClase.Create; // Create invoca al constructor heredado de la clase primaria
  ...
end;

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.