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

forkit forkit at gmail.com
Wed Jun 8 11:38:15 UTC 2022


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.


More information about the Digitalmars-d mailing list