The best way to clarify the question is to give an example of what I'm trying to do ...
I define a "base class":
TMyBaseClass = class(TPersistent)
protected
procedure Foo(const AValue: String); virtual;
end;
Now I define the descendant class:
TMyDescendantClass = class(TMyBaseClass)
public
procedure Foo(const AValue: String); override;
// etc. for all desired methods I wish to elevate into Public
end;
The problem here is that I need to override the "Foo" method for TMyDescendantClass to pass the call to the chain in TMyBaseClass:
procedure TMyDescendantClass.Foo(const AValue: String);
begin
inherited;
end;
This is a waste of space! I am wondering if anyone knows of any way to deny the need to override the method and the "inherited" acll.
An ideal solution would look something like this:
TMyDescendantClass = class(TMyBaseClass)
public
procedure Foo(const AValue: String); elevated;
// etc. for all desired methods
end;
Obviously, this is hypothetical, and I know that the keyword “elevated” does not exist in Delphi. Is there a keyword with the same effect that I just don’t know about?
Thank!
source
share