Hi.
I have a class TChild derived from TParent. TParent has a property MyProp that is reading and setting some values in an array. Of course this property is inherited by the TChild, but I want to add few extra processing in child's property. The code below explains better what I want to do but it is not working. How can I implement it?
TParent = class...
private
function getStuff(index: integer): integer; virtual;
procedure setStuff(index: integer; value: integer); virtual;
public
property MyProp[index: integer] read GetStuff write SetStuff
end;
TChild = class...
private
procedure setStuff(index: integer; value: integer); override;
function getStuff(index: integer): integer; override;
public
property MyProp[index: integer] read GetStuff write SetStuff
end;
procedure TChild.setStuff(value: integer);
begin
inherited; // <-- execute parent 's code and
DoMoreStuff; // <-- do some extra suff
end;
function TChild.getStuff;
begin
result:= inherited;
end;