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...") |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Constructor}} | {{Constructor}} | ||
− | <syntaxhighlight lang="pascal" | + | The [[Reserved word|reserved word]] <syntaxhighlight lang="pascal" inline>constructor</syntaxhighlight> belongs to [[object-oriented programming]]. |
+ | <syntaxhighlight lang="pascal" inline>Constructor</syntaxhighlight> is a [[Class|class]] builder [[Method|method]] that creates the object of that class. | ||
− | |||
Example: | Example: | ||
− | <syntaxhighlight> | + | <syntaxhighlight lang=pascal> |
// class definition | // class definition | ||
type | type | ||
Line 23: | Line 23: | ||
end; | end; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
+ | == See also == | ||
+ | |||
+ | * [[Destructor]] |
Latest revision as of 17:16, 6 August 2022
│
Deutsch (de) │
English (en) │
español (es) │
suomi (fi) │
русский (ru) │
The reserved word constructor
belongs to object-oriented programming.
Constructor
is a class builder method that creates the object of that class.
Example:
// class definition
type
TKlasse = class
end;
var
// declare variable of type of class
clsKlasse: TKlasse;
begin
...
// create class
clsKlasse := TKlasse.Create;
...
end;