Broken?

Andrej Mitrovic andrej.mitrovich at gmail.com
Wed Mar 12 06:19:05 PDT 2014


On 3/12/14, Steven Schveighoffer <schveiguy at yahoo.com> wrote:
> Private virtual functions make 0 sense. A private function cannot be
> accessed by a derived class.

It can if it's in the same module. You may want to have the benefit of
virtual functions, but also the benefit of those methods being
accessible in some internal API, but not to the user.

If you make them protected, they're accessible by user-derived
classes. You could make them package, but currently package is forced
non-virtual as well.

> Package, I'm less concerned about. You can make that virtual, I don't ever
> use package functions.

There is definitely a need for this. DFeed is full of these style of comments:

/+ package +/ /+ protected +/ override int _rtype() // package

It's obviously supposed to be hidden from the user, but it can't be.
So underscores are prepended instead.


More information about the Digitalmars-d mailing list