mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 20:29:32 +02:00

create a child object/class/interface instead of a copy of the original. This fixes override/inheritance checks, and is also Delphi-compatible git-svn-id: trunk@37927 -
31 lines
458 B
ObjectPascal
31 lines
458 B
ObjectPascal
program Project1;
|
|
{$Mode objfpc}
|
|
|
|
type
|
|
TFoo = class
|
|
constructor create; virtual;
|
|
end;
|
|
|
|
TBar = type TFoo;
|
|
|
|
TBaz = class(TBar)
|
|
constructor create; override;
|
|
end;
|
|
|
|
constructor TFoo.create;
|
|
begin end;
|
|
|
|
constructor TBaz.create;
|
|
begin end;
|
|
|
|
begin
|
|
if not tbar.inheritsfrom(tfoo) then
|
|
halt(1);
|
|
if not tbaz.inheritsfrom(tbar) then
|
|
halt(2);
|
|
if tbar.classname<>'TBar' then
|
|
halt(3);
|
|
if tfoo.classname<>'TFoo' then
|
|
halt(4);
|
|
end.
|