Hallo zusammen,
ich habe eine Verständnisfrage zu Interfaces in Delphi, und deren Freigabe dazu folgender kleiner Code ausschnitt
Delphi-Quellcode:
type
IMyInterface = interace
....
end;
TMyImplementation = class (TInterfacedObject, IMyInterface )
end;
implementation
function CreateTollesInterface : IMyInterface
begin
....
result := IMyTollesInterface.Create;
end;
Verstehe ich das bisher richtig:
Jedesmal wenn CreateTollesInterface eine Instanz der Klasse TMyImplementation erstellt, wird der FunktionsPointer von CreateTollesInterface mit in die References geschrieben und somit wird das Interface nie weg geräumt(refCount ist immer 1 weil Funktion global ist)?
Ich hoffe mich versteht jemand, falls ja Danke schon mal.