Is this expected? default to public members in private class

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun May 3 22:35:02 PDT 2015


On Sun, 03 May 2015 18:07:20 -0700, Dan Olson wrote:

> It seems a private class or struct defaults to public members.  Just
> curious if this is intended.  I would have expected private all the way
> down unless overriden.

i bet it is intended. protection of struct/class members is independed of 
protection of struct/class itself. this is good for code consistency: no 
changing of outer protection flags can alter struct/class inner 
machinery. so if you changed your mind about protection level of some 
global things, you shouldn't unnecessary "fix" your code in completely 
unrelated places.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150504/3d6e3bf7/attachment.sig>


More information about the Digitalmars-d-learn mailing list