d - How to set methods private to module? -
i have 2 d classes in 1 module. class have property, can accessed class , class b. how this?
class { int = 5; // make accessible to, , to, b. } class b { this(in pa) { int b = pa.a; } }
private
private module, not class. so, marking symbol private
makes stuff in module can access it.
package
makes stuff in same package can access symbol.
protected
makes stuff in class , in classes derived class can access symbol (unlike others, protected
makes no sense outside of classes).
public
makes can access symbol.
private
, package
functions never virtual, whereas protected
, public
functions virtual unless compiler able determine don't need (which @ point, can pretty happen when function final
, doesn't override function in base class).
so, long 2 classes in same module, , members private, can access each others members - can else within module - nothing outside module can access them. there no way restrict access within module except when symbol local function, if want make 1 class cannot access members of another, you're going need put them in separate modules.
Comments
Post a Comment