www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: This is not just a question.

reply Yonggang Luo <yonggangluo hotmail.com> writes:
//start file A.d
module A;
public class Base{}
public void baseFunction{}

//end file A.d

//start file B.d
module B;
private import A;
public void FunctionB(Base x); //at least this is illegal. Because ...
public Base FunctionElse(); /*This is also be illegal, the same reason*/

public class B:Base{}; /*I think this is illegal should be better*/
/* This means we can't access a private module through any way.*/
//end file B.d

//start file C.d  this fele is the reason...
module C;
private import B;
private void FunctionC()
	Base x; //illegal
	//so you can't access FunctionB(x); /*Because x can't be define*/
//end file C.d
Nov 14 2008
parent mgen <bmeck stedwards.edu> writes:
I'm sorry but a private import is not a private module. A private import is
seen as private by external modules and as such cannot be accessed. Also the
import would be meaningless if it changed the access privileges of any module
since by your logic public import would change private functions to public. If
you are trying to make a module that cannot have anything imported from it make
everything inside of the module private.
Nov 14 2008