![]() |
AW: Supports ohne out Parameter
Zitat:
|
AW: Supports ohne out Parameter
Zur Verdeutlichung des Ablaufs:
Delphi-Quellcode:
var
a: TFirstSecond; i: IInterface; f: IFirst; s: ISecond; begin a := TFirstSecond.Create; i := a; // a.RefCount wird 1 if Supports(a, IFirst) then // a.RefCount wird 2 und wieder 1 Writeln('a supports IFirst'); if Supports(a, ISecond) then // a.RefCount wird 2 und wieder 1 Writeln('a supports ISecond'); if Supports(a, IFirst, f) then // a.RefCount wird 2 Writeln('[out] a supports IFirst'); if Supports(a, ISecond, s) then // a.RefCount wird 3 Writeln('[out] a supports ISecond'); i := nil; // a.RefCount wird 2 f := nil; // a.RefCount wird 1 s := nil; // a.RefCount wird 0 und a wird freigegeben Readln; end. |
AW: Supports ohne out Parameter
Zitat:
|
AW: Supports ohne out Parameter
Zitat:
|
AW: Supports ohne out Parameter
Teste mal das (Jugend forscht :-) ):
Delphi-Quellcode:
if Assigned(TFirstSecond.GetInterfaceEntry(IFirst)) then
Writeln('TFirstSecond supports Interface IFirst'); if Assigned(TFirstSecond.GetInterfaceEntry(ISecond)) then Writeln('TFirstSecond supports Interface ISecond'); |
AW: Supports ohne out Parameter
Zitat:
|
AW: Supports ohne out Parameter
ist
Delphi-Quellcode:
nicht intuitiver?
if Supports(TFirstSecond, ISecond) then
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 15:26 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