mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-23 03:49:47 +02:00

a property in a child class has a higher visibility than the getter/ setter), ensure that we call the inherited method and not the method itself (causing a stack overflow due to infinite recursion) git-svn-id: trunk@25223 -
49 lines
726 B
ObjectPascal
49 lines
726 B
ObjectPascal
unit ujsetter;
|
|
|
|
{$namespace org.freepascal.test.jsetter}
|
|
{$mode delphi}
|
|
|
|
interface
|
|
|
|
type
|
|
tjsetterbase = class
|
|
protected
|
|
fval: longint;
|
|
procedure SetVal(v: longint); virtual;
|
|
public
|
|
function get: longint;
|
|
end;
|
|
|
|
tjsetterchild = class(tjsetterbase)
|
|
public
|
|
property Val: longint read fval write SetVal;
|
|
end;
|
|
|
|
tjsetterchild2 = class(tjsetterchild)
|
|
protected
|
|
procedure SetVal(v: longint); override;
|
|
public
|
|
property Val: longint read fval write SetVal;
|
|
end;
|
|
|
|
implementation
|
|
|
|
function tjsetterbase.get: longint;
|
|
begin
|
|
result:=fval;
|
|
end;
|
|
|
|
procedure tjsetterbase.SetVal(v: longint);
|
|
begin
|
|
fval:=v;
|
|
end;
|
|
|
|
procedure tjsetterchild2.SetVal(v: longint);
|
|
begin
|
|
fval:=v-1;
|
|
end;
|
|
|
|
|
|
end.
|
|
|