
Problem With friend methods
Quote:
>Hi.
>I have a huge problem with moving from Object space STL to Microsoft STL
>- all friend methods cannot use private members!!!
>Know problem/ bug?
I'm assuming the problem is with classes you writing and have
control over. If so, try checking to see if a "using namespace ..."
directive appears prior to the class declaration(s). If so, try moving
the directive to just after the class declaration (or preferably to .cpp
files and out of .h files altogether). If the friend methods have std
object types as a part of their signature, this will force explicit
signatures. I've used this successfully to circumvent the problem you
describe.
BEFORE:
using namespace std;
class X
{
friend ostream& operator<< (ostream& os, const X&);
:
AFTER:
class X
{
friend std::ostream& operator<< (
std::ostream& os, const X&);
:
using namespace std;
Good Luck,
Wes