Structs on private section.

deadalnix deadalnix at gmail.com
Sun Nov 27 17:56:20 PST 2011


Le 28/11/2011 03:29, Alexey Veselovsky a écrit :
>
>>>
>>>
>>>
>>>
>>>
>> D's private is different than some other languages (e.g. C++). 'private' provides access to the entire module.
>>
>> public: no access limitation
>>
>> private: access by the module
>>
>> package: access by the modules of the package
>>
>> protected: access by the inheriting classes
>
> But it works even if class Foo declarated in dufferent module.
>
> Also this code works:
>
> module a;
>
> private { struct S {int a;}}
>
> --------
>
> module b:
> import a:
>
> void f() {S s; s.a=42;}

So you now have discovered a bug.


More information about the Digitalmars-d mailing list