Why private methods cant be virtual?
ettienne.gilbert at gmail.com
Wed Sep 23 08:30:34 UTC 2020
On Tuesday, 22 September 2020 at 11:39:31 UTC, Daniel Kozak wrote:
> On Tue, Sep 22, 2020 at 1:30 PM ShadoLight via
> Digitalmars-d-learn < digitalmars-d-learn at puremagic.com> wrote:
>> This is not really "overriding", it is more akin to
> No it is not overloading, overloading is when you have more
> methods with same name and differents params. It is overriding
Which is why I said it is "is more akin to "overloading"" i.e.
what I meant is that the behaviour is kind-of "similar" to
overloading in your example. I did not mean it was classical
The thing is that, if the base class method is non-virtual,
calling it "overriding" is confusing and somewhat misleading -
all the derived class does is hide (or "shadow" if you like) the
base class method.
>> It is also not polymorphic
> I did not say otherwise :-)
Granted, but your example is confusing in the light that the OP
specially asked about virtual and polymorphic behaviour.
More information about the Digitalmars-d-learn