[fpc-pascal] Skipping an the "inherited" of an ancestor

Max Vlasov max.vlasov at gmail.com
Sat Jan 15 13:34:25 CET 2011


On Sat, Jan 15, 2011 at 2:09 PM, Torsten Bonde Christiansen
<tc at epidata.dk>wrote:

>  On 2011-01-14 23:05, Max Vlasov wrote:
>
>
>
>  On Fri, Jan 14, 2011 at 10:38 PM, Torsten Bonde Christiansen <
> tc at epidata.dk> wrote:
>
>> Hi List.
>>
>> Is it possible to jump a couple of levels in the inherited hierarchy when
>> calling "inherited" on a method?
>>
>>
> Hmm, don't know whether you're the same person or not :), but I replied in
> a stackoverflow question the next day after it was asked (see here:
> http://stackoverflow.com/questions/4662744/delphi-how-to-call-inherited-inherited-ancestor/4670457#4670457) and it looked like the host didn't notice :). At least this variant seemed
> to work
>
>
> I'm sorry to say that it is not I who wrote on stackoverflow, but could as
> well have been. Anyways, your solution does not really solve the problem,
> since i will have to introduce a HackedParent class and that kinds of defeat
> the purpose.
>

Torsten, the problem is that such purpose itself is a bit strange for OOP.
Imagine some of ancestors call some other virtual method inside the
procedure you need to call, and this method was overridden by your skipped
ancestor, in this case you have uncontrolled functionality of one of the
levels of hierarchy you want to skip. There's no way to control intermediate
ancestor completely so any possible solutions will be a kind of a hack.

Max
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20110115/f07b4a4c/attachment.html>


More information about the fpc-pascal mailing list