Eigentlich sollte man auch diesen debuggen können,
aber mach dir doch einfach mal ein
ShowMessage('...');
dort rein.
also bei mir Ruft der den Destruktor immer auf.
[add]
Code:
*** after inherited ***
MyClass1.Create
MyClass2a.Create
MyClass2a.Destroy
MyClass1.Destroy
*** befor after inherited ***
MyClass2b.Create
MyClass2b.Destroy
MyClass1.Destroy
* end
Delphi-Quellcode:
program Test;
{$APPTYPE CONSOLE}
uses
SysUtils,
Dialogs;
type
MyClass1 =
class
constructor Create;
destructor Destroy;
override;
end;
MyClass2a =
class(MyClass1)
constructor Create;
destructor Destroy;
override;
end;
MyClass2b =
class(MyClass1)
constructor Create;
destructor Destroy;
override;
end;
constructor MyClass1.Create;
begin
WriteLn('
MyClass1.Create');
end;
destructor MyClass1.Destroy;
begin
WriteLn('
MyClass1.Destroy');
end;
constructor MyClass2a.Create;
begin
inherited;
WriteLn('
MyClass2a.Create');
raise Exception.Create('
Fehler');
end;
destructor MyClass2a.Destroy;
begin
WriteLn('
MyClass2a.Destroy');
inherited;
end;
constructor MyClass2b.Create;
begin
WriteLn('
MyClass2b.Create');
raise Exception.Create('
Fehler');
inherited;
end;
destructor MyClass2b.Destroy;
begin
WriteLn('
MyClass2b.Destroy');
inherited;
end;
begin
WriteLn('
*** after inherited ***');
try
MyClass2a.Create;
except
end;
WriteLn('
*** befor after inherited ***');
try
MyClass2b.Create;
except
end;
WriteLn('
* end');
ReadLn;
end.