Module-level accessibility
bearophile
bearophileHUGS at lycos.com
Mon Oct 4 12:37:21 PDT 2010
Andrei:
> > I agree. Class A can access private methods of class B as long as both
> > defined in the same module. If it has access to private methods, why
> > can't it override them? Makes little sense, if you ask me, especially
> > given that user may prevent overriding methods using "final" keyword.
> > And the "package" also implying final is just ridiculous!
>
> This is a very good argument that in my mind settles the case.
I am not expert about this, but ignoring private attributes among classes/structs in the same module may be useful, but it's a dirty thing. If you split in two parts a module that contains two classes that access each other private members, the code stops working. Overriding private methods makes the situation even dirtier. I don't think C#/Java programmers will appreciate this :-)
Bye,
bearophile
More information about the Digitalmars-d
mailing list