How can parent procedure call it's child's procedure which was override from itself?
type
TBase = class(TForm)
procedure BtnRefreshClick(Sender: TObject);
protected
text: string;
end;
procedure TBase.BtnRefreshClick(Sender: TObject);
begin
showmessage(text);
end;
type
TParent = class(TBase)
protected
procedure doThis;
end;
procedure TParent.doThis;
begin
// blah blah do something
BtnRefreshClick(nil);
end;
type
TChild = class(TParent)
procedure BtnRefreshClick(Sender: TObject);
protected
procedure clicky; override;
end;
procedure TChild.BtnRefreshClick(Sender: TObject);
begin
text := 'Hello, World!';
inherited;
end;
Actual calling procedure will be somewhat like :
child := TChild.Create;
child.doThis;
If I try to do child.BtnRefreshClick; then it will produce a dialog of Hello, World! since TChild.BtnRefreshClick was called and the text variable were set.
But when I call child.doThis it will only shows an empty dialog box since child.doThis calls parent.doThis and then ??.BtnRefreshClick. How to make parent.doThis call child.BtnRefreshClick? Is it not possible?
Thanks in advance,
Yohan W.