how to make private class member private

psychoticRabbit meagain at meagain.com
Tue Mar 13 08:05:43 UTC 2018


On Tuesday, 13 March 2018 at 06:03:11 UTC, Mike Parker wrote:
>
> I think it's a great feature and I use it frequently. It's 
> allows more flexibility in class design. Without it, we'd need 
> another protection attribute to enable the concept of "private 
> to the module".
>

what about a new access attribute (and no, I haven't though this 
through much):

owned string _FirstName;

(now the class 'owns' this.

It is neither readable nor writeable outside the boundary of that 
class.

This retains the existing flexibilty offered by module level 
encapsulation, while restoring class level 
encapsulation/ownership.


More information about the Digitalmars-d-learn mailing list