Why do private member variables behaved like protected in the same module when creating deriving class?
unprotected-entity
unprotected-entity at gmail.com
Mon Oct 29 09:25:07 UTC 2018
On Monday, 29 October 2018 at 06:15:25 UTC, Mike Parker wrote:
> Encapsulation inside the file is rather pointless.
Say that to yourself a few times, and see if your view changes ;-)
(btw. just take a look at the length of some 'files', within
Phobos - I mean, gee, I really hope the developer of those files
did not share your view)
In any case, encapsulation in a file, still exists, just not so
much for classes
- function still have it, scope braces still have it..etc..etc...
but one of the most important constructs in programming, the
class, does not.
> I understand the argument about accidentally bypassing
> accessors to directly modify private members that shouldn't be
> modified.
It's not just that it could happen 'by accident', it's that D
actively encourages this, by making 'private' (within a module),
a completely useless construct.
It's there by default.
Just how often does one need to access the private members of a
class, within a module?
More information about the Digitalmars-d
mailing list