D - private ??
- eriser (19/19) Mar 29 2004 class pouet
- eriser (4/4) Mar 29 2004 return:
- e (5/5) Mar 29 2004 result !
- J Anderson (6/26) Mar 29 2004 //Module 2
- Andy Friesen (4/28) Mar 29 2004 It's because everything is in the same module. D treats them as
class pouet { private: this() { a = 3; } void test() { printf("private !!!"); } int a; } void main() { pouet p = new pouet(); p.test(); printf("%d", p.a); }
Mar 29 2004
return: C:\bin\code\D\dmd\dmd\bin\..\..\dm\bin\link.exe test,,,user32+kernel32/noi; D:\eriser\D>test.exe private !!!3
Mar 29 2004
result ! D:\eriser\D>dmd test.d C:\bin\code\D\dmd\dmd\bin\..\..\dm\bin\link.exe test,,,user32+kernel32/noi; D:\eriser\D>test.exe private !!!3
Mar 29 2004
eriser wrote: //Module 1class pouet { private: this() { a = 3; } void test() { printf("private !!!"); } int a; }//Module 2void main() { pouet p = new pouet(); p.test(); //Will be in error printf("%d", p.a); //Will be in error }Visibility rules are on the modular level in D, if that was your question. -- -Anderson: http://badmama.com.au/~anderson/
Mar 29 2004
eriser wrote:class pouet { private: this() { a = 3; } void test() { printf("private !!!"); } int a; } void main() { pouet p = new pouet(); p.test(); printf("%d", p.a); }It's because everything is in the same module. D treats them as friends. (to use the C++ term) -- andy
Mar 29 2004