![]() |
warum sehe ich public und published properties nicht?
Hallo,
Ich habe zum experimentieren ein Thread-Objekt wie folgt definiert:
Delphi-Quellcode:
So weit so gut. Im Hauptprogramm möchte ich es nutzen:
unit UThreadCapture;
interface ... type TCapture = class(TThread) private { Private declarations } s: string; ... protected ... public function test: boolean; ... published property ssss : string read s write s; end; implementation ...
Delphi-Quellcode:
Warum kann ich im Hauptprogramm nicht auf die public und published Methoden und Properties des Threadobjekts zugreifen? Was habe ich übersehen? Das müsste doch eigentlich so gehen. (Meine Frage zielt jetzt nicht auf Threadingsicherheit, sondern auf den Compiler).
var
Capture: TThread; ... Capture := TCapture.Create(true); //so weit so gut Capture.test; //kennt der Compiler nicht obwohl public!???? writeln(Capture.ssss); //kennt der Compiler nicht obwohl published!???? Gruß, Thomas |
Re: warum sehe ich public und published properties nicht?
Hallo :-)
definiere deine Variable vom Typ TCapture und nicht von TThread. Gruß Hudel |
Re: warum sehe ich public und published properties nicht?
Zitat:
Delphi-Quellcode:
heißen, oder? :zwinker:
var
Capture: TCapture; |
Re: warum sehe ich public und published properties nicht?
Oder beim Zugriff auf TCapture casten, aber wer will das schon, wenn es nicht nötig ist?
|
Re: warum sehe ich public und published properties nicht?
Da war jmd schneller mit dem Casten =)
Delphi-Quellcode:
Gruß, Tom
TCapture(Capture).test ....
|
Re: warum sehe ich public und published properties nicht?
Das war wirklich ne dumme Frage von mir. Beim Geschirrspülen kams mir jetzt auch.
Manchmal sieht man halt den Wald vor lauter Bäumen nicht... Danke. |
Re: warum sehe ich public und published properties nicht?
Zitat:
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:28 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz