Difference between revisions of "Constructor"

From Lazarus wiki
Jump to navigationJump to search
(Created page with "{{Constructor}} <syntaxhighlight lang="pascal" enclose="none">Constructor</syntaxhighlight> is a class builder method that creates the object of that cl...")
 
Line 23: Line 23:
 
end;
 
end;
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
== See also ==
 +
 +
* [[Destructor]]

Revision as of 22:26, 18 March 2019

Deutsch (de) English (en) español (es) suomi (fi) русский (ru)

Constructor is a class builder method that creates the object of that class.

The word constructor is a reserved word. Example:

// class definition
type
  TKlasse = class
  end;

var
  // declare variable of type of class
  clsKlasse: TKlasse;

begin
  ...
  // create class
  clsKlasse := TKlasse.Create; 
  ...
end;

See also