Sign in Join
Wiki copytemporary

Constructor/de

Deutsch · English · Español · Suomi · Русский

Zurück zu den reservierten Wörtern.\

Das Schlüsselwort constructor gehört zur objektorientierten Programmierung.
Ein Konstruktor dient zum initialisieren der Klasse.
Einfache Klassen, die keine Initialisierung benötigen, brauchen keinen Konstruktor.
Ein selbst geschriebene Klasse die selbst keinen Konstruktor hat kann von Ihrer Elternklasse (sofern diese einen Konstruktor hat) den Konstruktor erben.\

Beispiel:\

pascal
// Klassendefinition
type
  TKlasse = class
  end;

var
  // Variable vom Typ der Klasse bekannt machen (deklarieren)
  clsKlasse: TKlasse;

begin
  ...
  // Klasse erstellen
  clsKlasse := TKlasse.Create; // Create ruft den von der Elternklasse geerbten Konstruktor auf
  ...
end;

--Olaf 17:18, 24 October 2012 (UTC)


From the Free Pascal wiki, page "Constructor/de", 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.

Revision 2, last changed by WikiArchive .

Edited on wiki.freepascal.org by 3 people, 2012–2020

From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.

WhenWhoWhat changed
OlafCreated page
Olaf (minor)
Olaf (minor)
Olaf (minor)
Useroflazarus
BartUse pascal highlighter

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.