Protection package and export

Derek Parnell derek at psych.ward
Thu Jan 3 08:00:53 PST 2008


On Thu, 03 Jan 2008 10:18:27 -0500, Luca wrote:

> Hello, I known that there are 4 type of protection for the Fields and methods of the class:
> 
> private: Accessible only by functions of the class
> public: Accessible also from the rest of the program
> 
> But I do not know the meanings of package and export, someone knows this??

Well actually in D the meanings above are not quite accurate. In D the
meanings are ...

Private: Accessible to code in the same module.

Protected: Accessible to code in the same module and from classes derived
from the protected class. (Only applies to classes).

Public: Accessible to code in any module.

Package: Accessible to code in any module within the same package, which
means in the same directory.

Export: Accessible to code in other applications.

-- 
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell



More information about the Digitalmars-d mailing list