Focus

Walter Bright newshound2 at digitalmars.com
Fri Jan 18 14:29:45 PST 2013


On 1/18/2013 2:16 PM, Andrey wrote:
> I'm now still on 2.060 release, and I was shocked when suddenly have discovered
> that member visibility and access attributes just don't work! Well, 2060
> release, and I can easily compile such thing:
>
> struct MyStruct {
>     private int a;
> }
>
> MyStruct ms;
> ms.a = 42; //!!!
> writeln(ms.a);


This is by design, not a bug. All code in a module has access to all private 
members in that same module. This obviates the need for the C++ "friend" 
declarations.



More information about the Digitalmars-d mailing list