Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Klasse TObjectList - neue Property hinzufügen? (https://www.delphipraxis.net/116245-klasse-tobjectlist-neue-property-hinzufuegen.html)

Yheeky 25. Jun 2008 15:27


Klasse TObjectList - neue Property hinzufügen?
 
Hi,

ich habe ein Objekt der Klasse TObjectList. Ich würde gerne eine neue property hinzufügen.

Delphi-Quellcode:
property AnzahlAutos : Integer; read getAutoAnzahl;
Als Fehlermeldung bekomme ich:
Code:
[Pascal Fehler] Auto.pas(19): E2147 Eigenschaft 'AnzahlAutos' existiert nicht in Basisklasse
Wie kann ich denn eine neue Property hinzufügen? Das wird doch wohl gehen, oder?!

Sherlock 25. Jun 2008 15:30

Re: Klasse TObjectList - neue Property hinzufügen?
 
Mach doch einen neue Klasse, die Du von TObjectList ableitest...dann kannste Dich austoben. Aber einem Objekt einer Klasse kann man nicht mehr erweitern...das ist normal.

Sherlock

Dax 25. Jun 2008 15:32

Re: Klasse TObjectList - neue Property hinzufügen?
 
Delphi-Quellcode:
property AnzahlAutos : Integer read getAutoAnzahl;
Ohne das ; - sonst denkt Delphi, dass du eine Property der Basisklasse auf ein anderes Sichbarkeitsniveau heben willst.

mkinzler 25. Jun 2008 15:32

Re: Klasse TObjectList - neue Property hinzufügen?
 
Höchstens per Class Helper

Yheeky 25. Jun 2008 15:50

Re: Klasse TObjectList - neue Property hinzufügen?
 
Zitat:

Zitat von Dax
Delphi-Quellcode:
property AnzahlAutos : Integer read getAutoAnzahl;
Ohne das ; - sonst denkt Delphi, dass du eine Property der Basisklasse auf ein anderes Sichbarkeitsniveau heben willst.

Super, so funktioniert´s! Danke!


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:46 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz