We have the TAncestor class which has a virtual method GetFile.
We will have some TDescendant = class(TAncestor) which may override GetFile.
We want to insure that in such a case those overriden methods do not call inherited in their implementation.
But if they don't implement GetFile and just use the one from TAncestor, it's fine.
Is there a (simple) way to do this?
to make it clearer:
- yes, doc clearly says 'do not use inherited in your descendant class'
- I have no control of what others will code when overriding and don't rely on them reading the doc
- I cannot restrict the execution to the exact class TAncestor as it is legit for descendant to use it if they don't provide their own implementation
- I cannot make it abstract because it needs to have a default implementation
- I want to enforce this with a way of detecting in the base class that the code is called through a descendant overridden implementation
- Looking at the stack seems overkill but is my 1st idea so far