War da nicht auch was mit Abstraktheit? Also wenn ich jetzt eine Klasse hab:
Delphi-Quellcode:
type
TFoo =
class
private
Bar: TBlub;
public
constructor Create;
destructor Destroy;
end;
implementation
constructor TFoo.Create;
begin
Bar := TBlub.Create;
end
destructor TFoo.Destroy;
begin
Bar.Free;
end;
{andere Unit}
uses UnitMitTFoo;
var
f: TFoo;
o: TObject;
begin
f := TFoo.Create;
o := f;
o.Destroy;
end;
Wenn Destroy jetzt nicht grad abstarkt ist, ruft das den Destruktor nur von TObject auf, und hinterlässt ein erstelltes TBlub als Speicherleck. Da ich die Sourcen (bzw. Delphi) nicht hier hab, kann ich das nicht genau prüfen - aber sollte Free evtl. sowas behandeln? *kopfkratz* Irgendwas war da auf jeden Fall...
"When one person suffers from a delusion, it is called insanity. When a million people suffer from a delusion, it is called religion." (Richard Dawkins)