should protected imply package?

Jarrett Billingsley jarrett.billingsley at gmail.com
Thu Sep 24 12:36:46 PDT 2009


On Thu, Sep 24, 2009 at 1:38 PM, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> In Java, "protected"-level protection implies package-level protection (see
> e.g.
> http://java.sun.com/docs/books/tutorial/java/javaOO/accesscontrol.html).
> Should we copy that behavior in D, or take advantage of the package keyword
> and require it as in "package protected"?

Under the current implementation, if protected implied package, all
protected methods would suddenly become nonvirtual, since for some
reason, package is treated as a kind of 'private'. Not really what
you'd want, I think ;)

'package' should not conflate visibility and virtuality. If it didn't
do that, having protected imply package would be just fine.



More information about the Digitalmars-d mailing list