I always understood class helpers as extension classes, or partial classes. They act like an expand for the code of the original base class. If I copied the interface part of code and add it to the base class and do so for the implementation too, the code will run perfectly the same way as with the helper. This let me always understand the polymorphisme in helpers and why they can't override methods from the base class and such things.
But I found that this is not completely true, because if so then why they don't allow to override methods of an ancestor -parent of the base- class?
Here is an example of what I mean(I will only put the code for the headers without implementation code):
type
TAncestor = class
public
procedure Test; virtual;
end;
TBase = class(TAncestor)
public
end;
So why the next code is not right :
THelper = class helper of TBase
public
procedure Test; override;
end;
The error that I have is :
Method 'Test' not found in base class!
TBase
rather than extendTBase
. Or override the method inTBase
. – Niels