Hi,
I'm looking for a solution with friend concept. The friend class is out of the namespace. It isn't in any namespace. So, is there a solution?
Ouput:Code:namespace b { class Test { public: friend class Test2; ~Test(){}; private: Test(){}; }; }; // end namespace b class Test2 { public: Test2(){}; ~Test2(){}; void test() { b::Test* t = new b::Test(); }; }; int main(){ Test2 t; t.test(); return 0; }
main.cpp: In member function ‘void Test2::test()’:
main.cpp:11: error: ‘b::Test::Test()’ is private
main.cpp:24: error: within this context
Thank you very much for your time.
greetings




Reply With Quote
