D - "friend"-replacement?
- Norbert Nemec <Norbert.Nemec gmx.de> Apr 25 2004
- J Anderson <REMOVEanderson badmama.com.au> Apr 25 2004
- Norbert Nemec <Norbert.Nemec gmx.de> Apr 25 2004
- "Ivan Senji" <ivan.senji public.srce.hr> Apr 25 2004
- "Scott Egan" <scotte tpg.com.aux> Apr 25 2004
- Norbert Nemec <Norbert.Nemec gmx.de> Apr 25 2004
- J Anderson <REMOVEanderson badmama.com.au> Apr 25 2004
Hi there, obviously, "friend" declarations from C++ do not exist in D. Is there any alternative way to implement a group of classes that interdepend on each other's internals without exposing these to the outside world? Thanks, Nobbi
Apr 25 2004
Norbert Nemec wrote:Hi there, obviously, "friend" declarations from C++ do not exist in D. Is there any alternative way to implement a group of classes that interdepend on each other's internals without exposing these to the outside world?
-- -Anderson: http://badmama.com.au/~anderson/
Apr 25 2004
J Anderson wrote:Norbert Nemec wrote:obviously, "friend" declarations from C++ do not exist in D. Is there any alternative way to implement a group of classes that interdepend on each other's internals without exposing these to the outside world?
??? As far as I understand, you can have classes and functions private to a module or class members private to the class, but how do you make class members private to the module?
Apr 25 2004
"Norbert Nemec" <Norbert.Nemec gmx.de> wrote in message news:c6g2ft$16na$1 digitaldaemon.com...J Anderson wrote:Norbert Nemec wrote:obviously, "friend" declarations from C++ do not exist in D. Is there
alternative way to implement a group of classes that interdepend on each other's internals without exposing these to the outside world?
??? As far as I understand, you can have classes and functions private to a module or class members private to the class, but how do you make class members private to the module?
This is not possible. One module should contain only classes that are friends.
Apr 25 2004
From memory private in a class is only private to the module. See: http://www.digitalmars.com/d/attribute.html "Norbert Nemec" <Norbert.Nemec gmx.de> wrote in message news:c6g2ft$16na$1 digitaldaemon.com...J Anderson wrote:Norbert Nemec wrote:obviously, "friend" declarations from C++ do not exist in D. Is there
alternative way to implement a group of classes that interdepend on each other's internals without exposing these to the outside world?
??? As far as I understand, you can have classes and functions private to a module or class members private to the class, but how do you make class members private to the module?
Apr 25 2004
Scott Egan wrote:From memory private in a class is only private to the module.
OK, the documentation can be understood like that, but it is not very concise in this point.
Apr 25 2004
Norbert Nemec wrote:As far as I understand, you can have classes and functions private to a module or class members private to the class, but how do you make class members private to the module?
I'm not quite sure what you asking. When you use private in a module (whether it's within a class or not) it behaves on the module level. ie class A { private int x; } void main() { A a = new A; a.x = 10; //No error (if it was a different module there would be) } -- -Anderson: http://badmama.com.au/~anderson/
Apr 25 2004









"Ivan Senji" <ivan.senji public.srce.hr> 