Private variables accessible from outside class

matheus matheus at gmail.com
Thu Aug 8 15:57:28 UTC 2019


On Thursday, 8 August 2019 at 15:51:45 UTC, Drobet wrote:
> ...
> My question is if this is intended behavior, and if yes, why?

This is true if the class is inside the same module:

"Private means that only members of the enclosing class can 
access the member, or members and functions in the same module as 
the enclosing class. Private members cannot be overridden."[1]

Matheus.

[1]https://wiki.dlang.org/Access_specifiers_and_visibility




More information about the Digitalmars-d-learn mailing list