Using closure in function scope to make "real" private class members

bauss jj_1337 at live.dk
Wed Jun 8 11:49:26 UTC 2022


On Wednesday, 8 June 2022 at 11:38:15 UTC, forkit wrote:
> On Wednesday, 8 June 2022 at 11:32:48 UTC, forkit wrote:
>>
>
> Another option is:
>
> class myClass
> {
>     private[myClass] int x; // private to this abstraction.
>     private int y; // private to the module
> }
>
> same for a struct:
>
> struct myStruct
> {
>     private[myStruct] int x;
>     private int y;
> }
>
>
> I kinda like this.

I don't like it, it seems to add much more clutter, like imagine 
some long generic type name.



More information about the Digitalmars-d mailing list