fpc/tests/tbs/tb0259.pp
Jonas Maebe 005bdc1af4 * fixed "inherited some_property" constructs for getters/setters
(mantis #10927)
  * extended the tb0259 test a bit (tests similar constructs in
    case there is no getter/setter)

git-svn-id: trunk@10456 -
2008-03-07 19:29:40 +00:00

40 lines
636 B
ObjectPascal

{ Old file: tbs0302.pp }
{ inherited property generates wrong assembler OK 0.99.13 (PFV) }
{$ifdef fpc}{$mode objfpc}{$endif}
type
c1=class
Ffont : longint;
property Font:longint read Ffont write Ffont;
end;
c2=class(c1)
function GetFont:longint;
procedure setfont(l: longint);
end;
function c2.GetFont:longint;
begin
result:=inherited Font;
end;
procedure c2.SetFont(l: longint);
begin
inherited font := l;
end;
var
c: c2;
begin
c:=c2.create;
c.ffont:=5;
if c.getfont<>5 then
halt(1);
c.setfont(10);
if c.getfont<>10 then
halt(2);
if c.ffont<>10 then
halt(3);
end.