Structs on private section.
Ali Çehreli
acehreli at yahoo.com
Sun Nov 27 17:22:19 PST 2011
On 11/27/2011 03:57 PM, Alexey Veselovsky wrote:
> Hi!
>
> It seems like structs in private section (module or class) remains public:
>
> class A {
> private:
> struct B {int b;}
> }
>
> void foo() {A.B b; b.b=10;}
>
> this code compiles ok.
>
> WTF?
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
Ali
More information about the Digitalmars-d
mailing list