fpc/tests/tbs/tb0513.pp
Jonas Maebe a15e5dc61c * always call tobject.create/free in MacPas mode for new/dispose constructs
(since macpas methods may accidentally be called like that as well,
     as it doesn't have any constructors/destructors)
  + some tests for MacPas objects from the GNU Pascal testsuite

git-svn-id: trunk@5421 -
2006-11-18 13:36:38 +00:00

42 lines
553 B
ObjectPascal

{ original: peter5c.pas from the GNU Pascal testsuite }
{$mode macpas}
program peter5c(output);
type
ObjectA = object
procedure Doit;
end;
ObjectB = object
obj: ObjectA;
function GetA: ObjectA;
end;
var
ok: boolean;
procedure ObjectA.Doit;
begin
WriteLn( 'OK' );
ok := true;
end;
function ObjectB.GetA: ObjectA;
begin
return obj;
end;
var
a: ObjectA;
b: ObjectB;
begin
New(a);
New(b);
b.obj := a;
b.GetA.Doit;
if not ok then
halt(1);
end.