bug?

BCS BCS at pathlink.com
Thu Apr 5 10:33:37 PDT 2007


bobef wrote:
> a.d -------------------------
> import b;
[...]
> 
> class D : C
> {
> 	void fff(){a=5;}
> }
> 
[...]
> b.d ----------------------------------------------------
> class C
> {
> 	private:
> 	int a;
> }
> 
> What the? Not accessible for the child class but accessible for other classes/functions in the same module?

private is "private to this module". In C++ terms (if I remember c++ 
correctly), everything in a given module has friend access to everything 
else.

The assumption seems to be that if it is in the same module, then 
encapsulation isn't really that useful. If more separation than that is 
needed, then the parts should probably be in different modules anyway.


More information about the Digitalmars-d-bugs mailing list