Getting module of a class

bearophile bearophileHUGS at lycos.com
Fri Oct 17 06:45:16 PDT 2008


Bill Baxter:
> I'm thinking it would be nice if you could do something like
> ModuleOf(BCDS).ANonMemberFuncton to get at one of those non-member
> functions in BCDS's module whatever that may be.

The standard and simple solution to this problem is to import just the name of the module. You can do this with a static import, and you can use an alias to shorten the module name too:

static import bc = packagename.modulename;
auto x = new bc.SomeClass(...);
...
auto y = bc.nonMemberFunction(...);

Bye,
bearophile



More information about the Digitalmars-d mailing list