www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Module level privacy

reply "Jarl =?UTF-8?B?QW5kcsOpIg==?= <jarl.andre gmail.com> writes:
Hi

I just noticed that by setting a class to private in a module, 
its not inaccessible by other modules including the mentioned 
module. What am I saying syntactically when I am setting a class 
to private in a module? Will it be hidden by third level 
includers? (a module C that includes module B that includes 
module A that contains private class Z)? Or is the private 
modifier practically useless at module level?
Jun 11 2012
parent "Jonathan M Davis" <jmdavisProg gmx.com> writes:
On Monday, June 11, 2012 19:59:24 Jarl André" 
<jarl.andre gmail.com> puremagic.com wrote:
 Hi
 
 I just noticed that by setting a class to private in a module,
 its not inaccessible by other modules including the mentioned
 module. What am I saying syntactically when I am setting a class
 to private in a module? Will it be hidden by third level
 includers? (a module C that includes module B that includes
 module A that contains private class Z)? Or is the private
 modifier practically useless at module level?
Classes aren't affected by public, private, etc. Their members are. So, if you mark a class as private, that just makes all of its members private. That doesn't prevent you from declaring a variable of that type. It just prevents you from constructing it or using any of its members. Also, if you're dealing with a template, then private is currently ignored, which is definitely a bug ( http://d.puremagic.com/issues/show_bug.cgi?id=2775 ). - Jonathan M Davis
Jun 11 2012