On 2/14/11, Steven Schveighoffer <schvei...@yahoo.com> wrote: > What's wrong with: > > class Foo { > private int _x, _y; > this(int x, int y) { > _x = x; > _y = y; > } > int sumXY() { > return _x + _y; > } > }
Nothing! But the OP asked why it's possible to access the private state of a class if the code that accesses it is in the same module as the class. So I just threw in an example (which admittedly doesn't make much sense, and personally I don't like to access private state outside the class).