[Issue 19943] Field base access works for virtual methods

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 6 14:38:31 UTC 2019


Basile-z <b2.temp at gmx.com> changed:

           What    |Removed                     |Added
                 CC|                            |b2.temp at gmx.com
           Hardware|x86_64                      |All
                 OS|Linux                       |All

--- Comment #1 from Basile-z <b2.temp at gmx.com> ---
I see this more as a feature.

It is occasionally useful and without that it would painfully hard (as seen in
other languages that don't support this, some trickery with delegates and cast
must be used) to call a less derived virtual method from a more derived type.

A use case is when you derive a class from a framework that you don't control
and that its protection attributes or its class hierarchy have flaws. E.g: Some
useful things are done in Framework.A, Only a small thing you want to avoid is
done in Framework.B but your Own.C must derive from Framework.B because the
rest is ok and you don't want to copy and paste 95% of Framework.B


More information about the Digitalmars-d-bugs mailing list