D - [BUG?] Private/protected class member accessable
- Daniel Skorupski (16/16) Apr 22 2004 When accessing static members of a class in a different module, private
When accessing static members of a class in a different module, private and protected members are not protected when accessed directly (through MyClass.staticMember) but are when accessed through an instance of that class (myClassInst.staticMember). This seems incorrect. Also, when accessing a module member declared privated, if you specify the module when accessing (mymodule.privateMember) it is not protected while it is when you don't (privateMember) Relevant sections of the spec: "Private means that only members of the enclosing class can access the member, or members and functions in the same module as the enclosing class." "Protected means that only members of the enclosing class or any classes derived from that class can access the member." And one last minor thing in the spec it is stated "Protected module members are illegal." yet I can apply "protected" to a module member and the compiler doesn't complain. Sample code attached
Apr 22 2004