Why is the 'protected' attribute considered useless?

simendsjo simendsjo at gmail.com
Wed Jan 30 01:20:54 PST 2013


On Wednesday, 30 January 2013 at 03:38:39 UTC, Chad Joan wrote:
> I've read more than once now that 'protected' is considered 
> useless in D.  Why is this?

I'm not sure what articles you are referring to, but a couple of 
points it might think of:
* Anything protected can be made public by derived classes, thus 
any protected member is not much more "safe" than public.
* private and protected in D works at module scope, not class 
scope. You can modify private and protected members from anywhere 
in the module.


More information about the Digitalmars-d-learn mailing list