Why is protected not also implicit package?
Sergey Gromov
snake.scaly at gmail.com
Fri Aug 29 19:52:09 PDT 2008
Frank Benoit <keinfarbton at googlemail.com> wrote:
> While porting Java code this is kind of annoying.
> In Java a protected member is also accessbible from the package.
> And I think this would also make sense for D.
I think that D is closer to C++ than to Java. In C++, private and
protected are class-scoped. In D they're module-scoped but are easily
reduced to class scope if you write one class per module.
D way allows for better control over method visibility: you can separate
polymorphic interface and library interface. Java forces you to publish
any polymorphic methods to the library.
As to porting, it sounds easier to make all protected members public---
this doesn't chane much compared to Java.
--
SnakE
More information about the Digitalmars-d
mailing list