Why private methods cant be virtual?
claptrap
clap at trap.com
Mon Sep 21 23:17:13 UTC 2020
Seems like a completely pointless restriction to me. I mean it
will only affect other descendent classes declared in the same
module, and they can access all the private members anyway, so
it's locking the front door but leaving the back door wide open.
On the other hand if you actually want a private method to be
virtual, you have to instead use a protected method, so it
exposes it to be overridden elsewhere.
So it's no benefit on one hand, and net loss on the other.
Plus orthogonality, why should virtual or not be dependent on
visibility. Two separate concepts, tied together for no benefit.
What am I missing?
More information about the Digitalmars-d-learn
mailing list