mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-06 21:07:58 +02:00
48 lines
746 B
ObjectPascal
48 lines
746 B
ObjectPascal
{$MODE objfpc}
|
|
uses SysUtils, Classes;
|
|
type
|
|
TFirstClass = class
|
|
constructor Create;
|
|
destructor Destroy; override;
|
|
end;
|
|
TSecondClass = class(TFirstClass)
|
|
constructor Create;
|
|
destructor Destroy; override;
|
|
end;
|
|
|
|
constructor TFirstClass.Create;
|
|
begin
|
|
raise Exception.Create('');
|
|
end;
|
|
|
|
destructor TFirstClass.Destroy;
|
|
begin
|
|
WriteLn('TFirstClass.Destroy');
|
|
inherited Destroy;
|
|
end;
|
|
|
|
constructor TSecondClass.Create;
|
|
begin
|
|
inherited Create;
|
|
end;
|
|
|
|
destructor TSecondClass.Destroy;
|
|
begin
|
|
WriteLn('TSecondClass.Destroy');
|
|
end;
|
|
|
|
var
|
|
o: TSecondClass;
|
|
begin
|
|
try
|
|
try
|
|
o := TSecondClass.Create;
|
|
finally
|
|
o.Free;
|
|
end;
|
|
except
|
|
on e: Exception do
|
|
WriteLn('Exception: ', e.Message);
|
|
end;
|
|
end.
|