![]() |
Interfacedeklaration, brauche Hilfe!
Hallo ich habe ein Problem bei der Deklaration von folgenden Interface:
Delphi-Quellcode:
Die Zeile " FParent : TApp;" schmeisst die Compilermeldung "undefinierter Bezeichner", da TApp erst später deklariert wird. Wie kann ich das umgehen, OHNE TApp voher zu definieren?(Da TApp ebenfalls TSession nutzt, bleibt das Problem bestehen). Vielen Dank schonmal.
TSession = class(TTypedComObject, ISession)
private FSession :TSession; FstrType :string; //FFolders :TFolders; FParent : TApp; strSessionID :string; MyToolbox : TToolbox; MyWininet : TWininet; MyURLInfo : TURLInfo; protected function Logoff: HResult; stdcall; function Logon(Username, Password: OleVariant): HResult; stdcall; function setIP(Value: OleVariant): HResult; stdcall; constructor Create; destructor Destroy; {ISession-Methoden hier deklarieren} public //TODO: properties implementieren, methoden implementieren(GetDefaultFolder) //property Folders: TFolders read FFolders write FFolders; property Parent: TApp read FParent write FParent; property Session: TSession read FSession write FSession; property _type: string read FstrType write FstrType; end; TApp = class(TTypedComObject, IApp) private FApplication :TApp; FSession :TSession; FName :string; FVersion :string; protected {IApp-Methoden hier deklarieren} public property Application: TApp read FApplication write FApplication; property Session : TSession read FSession write FSession; property Name : string read FName write FName; property Version : string read FVersion write FVersion; end; [edit=SirThornberry]Delphi-Tags gesetzt - Mfg, SirThornberry[/edit] |
Re: Interfacedeklaration, brauche Hilfe!
Moinsen,
versuch es mal so...
Delphi-Quellcode:
type
TApp = class; TSession = class(TTypedComObject, ISession) private FSession: TSession; FParent: TApp; ... end; TApp = class(TTypedComObject, IApp) private ... end; |
Re: Interfacedeklaration, brauche Hilfe!
Vielen Dank, scheint zu funktionieren
|
Re: Interfacedeklaration, brauche Hilfe!
Zitat:
wird zwar funktionieren, aber ist imho eine unschöne Lösung. Das Problem dass du hier hast ist die gegenseitige Abhängigkeit von TApp und TSession. Da ist es dann aber gerade sauber, wenn du hier die wirklich benötigte Funktionalität in einem Interface festlegst und dann sowas hast wie:
Delphi-Quellcode:
Dann kannst du auch mit einem TApp und einer beliebigen ISession arbeiten.
TSession = class(TTypedComObject, ISession)
private FSession: ISession; FParent: IApp; .... TApp = class(TTypedComObject, IApp) private FApplication :IApp; FSession :ISession; Gruß Der Unwissende |
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:05 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