how to make private class member private
psychoticRabbit
meagain at meagain.com
Sat Mar 17 11:08:27 UTC 2018
On Saturday, 17 March 2018 at 09:18:13 UTC, Nick Treleaven wrote:
> It's a language design decision as to whether a particular
> feature is worth supporting. I would like this feature too
> though. I'm not sure how much compiler complexity would be
> added by having another visibility modifier.
>
D could add an new attribute to class members: @deny
A @deny attribute can come before a classes private member, to
indicate that the private member is to remain private, even
within the module.
Cause sure, it nice to be among friends, but you don't want your
friends knowing every thought that is going through your mind!
Sometimes, somethings, just need to remain private.
@deny private string _userName;
now... _userName is no longer accessible at the module level, and
class encapsulation is restored.
If had I any clue about compilers, I'd think this through more ;-)
More information about the Digitalmars-d-learn
mailing list