Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!sdd.hp.com!elroy.jpl.nasa.gov!decwrl!shelby!unix!hplabs!hpcc05!hpcuhb!hpscdc!toan From: toan@hpscdc.scd.hp.com (Toan Tran) Newsgroups: comp.lang.c++ Subject: Re: No friendship for private constructors? Message-ID: <4180001@hpscdc.scd.hp.com> Date: 20 Feb 91 21:00:50 GMT References: <2442@key.COM> Organization: Hewlett-Packard, Santa Clara Div. Lines: 48 I am not a language lawyer so I am not going to say anything about the behaviour you are getting. But I have a suggestion for what you are trying to do. How about writing a public member function for class Two that calls the class One constructor and use that member function instead. Some thing similar to this: ----------------- #include class One { friend class Two; private: One(){ cout << "constructing class One instance\n";} }; class Two { public: Two(){ cout << "constructing class Two instance\n";} One *make_one(){return new One();} }; main() { One *ione; Two *itwo; // instantiating itwo of class Two itwo = new Two(); // instantiatin ione of class one by calling Two::make_one() ione = itwo->make_one(); } ------------------- output of the above: constructing class Two instance constructing class One instance I am not sure this is what you want to do but... -- Toan Tran California Design Center/Bipolar Design Section Hewlett Packard toan@cdc.hp.com