private module members

Dan dbdavidson at yahoo.com
Tue Oct 16 11:57:11 PDT 2012


According to the spec, private module members are equivalent to 
static
declarations in C programs. Why does this work (i.e. print 5)?
Both imported.d and sample.d are in same directory 
(.../attributes).

Thanks
Dan

----------------------------------------------------------------------
import std.stdio;
import play.education.attributes.imported;

void main() {
   WhyIsAccessible s;
   writeln(s.x);
}
----------------------------------------------------------------------
module play.education.attributes.imported;
private:
struct WhyIsAccessible {
   int x = 5;
}
----------------------------------------------------------------------


More information about the Digitalmars-d-learn mailing list