Module-level accessibility

Sergey smsmfk at gmail.com
Sun Oct 3 01:50:26 PDT 2010


Hi, I'm a newcomer to D. Several days ago I've stumbled upon a very  
strange thing about D. As I understand, module members, such as classes,  
structs, functions and variables can be marked with an accessibility  
attribute, such as private, public, package or export. Say, there's a  
module named "test.d":

module test;

private int x1;
public int x2;

private void fnc1()
{
}
public void fnc2()
{
}

private class C1 {}
public class C2 {}

With a great surprise, I have discovered that from another module it is  
still possible to access both x1 and C1, though fnc1() is inaccessible !
Can anyone explain me what does it mean ?
Thanks in advance.


More information about the Digitalmars-d mailing list