I've got a problem concerning the << operator. Although I've declared it as
a friend function it cannot access the private member of the class AVLtree.
Some code:
------------------
class AVLtree
{
public:
friend ostream& operator << (ostream& os, AVLtree& t){};
.... some unimportant stuff ...
private:
Tree tree;
};
ostream& operator << (ostream& os, AVLtree& t)
{
// if (t.tree!=NULL)
os << *(t.tree);
return os;
}
----------------
I cannot figure out why the compiler tells
error C2248: 'tree' : cannot access private member declared in class
'AVLtree'
Any advice?
Thanks in advance,
Matthias
--
Für emails Anweisung in der Adresse befolgen
a friend function it cannot access the private member of the class AVLtree.
Some code:
------------------
class AVLtree
{
public:
friend ostream& operator << (ostream& os, AVLtree& t){};
.... some unimportant stuff ...
private:
Tree tree;
};
ostream& operator << (ostream& os, AVLtree& t)
{
// if (t.tree!=NULL)
os << *(t.tree);
return os;
}
----------------
I cannot figure out why the compiler tells
error C2248: 'tree' : cannot access private member declared in class
'AVLtree'
Any advice?
Thanks in advance,
Matthias
--
Für emails Anweisung in der Adresse befolgen
Comment