Inner Modules?

forkit forkit at gmail.com
Sat Feb 12 19:29:05 UTC 2022


so you can have classes within classes (inner classes).

how about modules within modules (inner modules)?

why? as a means to enforce private 'within' a module.

// -----

module test;

inner module myClasses
{
     class Foo
     {
         // private to the inner module
         private int _num;
     }
}

void main()
{
     Foo f = new test.myClasses.Foo();
     f._num++; // nope!
}

// ---


More information about the Digitalmars-d mailing list