Hi all, I have redefined the >>
operator as a friend function in a template class in the header. In it, i need to call another function called inputHelper
that I have also defined in the header. (input helper is recursive)
the header file is as follows:
template< typename NODETYPE > class Forest
{
/* (other friends) */
friend void inputHelper(istream& file, int previousDepth,
ForestNode<NODETYPE>& previousNode, ForestNode<NODETYPE> *nodeArray,
int nodeCount)
{
/* (dostuff) */
if(someconditional)
{
/* call inputHelper */
}
}
friend istream& operator>>(istream& file, Forest<NODETYPE>& f1)
{
/* (dostuff) */
/* (call inputHelper) */
}
public:
/* ... */
private:
/* ... */
}
However, at compile, it says |140|error: 'inputHelper' was not declared in this scope|
. Do you have to do something special because they are both defined as friend functions in the header? I kind of understand that inputHelper
is outside of the scope of the class, but I'm not sure how to resolve this.