The error is: No instance of overloaded function "BSTree::Retrieve" matches argument list and object (the object has type qualifiers that prevent a match).
argument types are: (int
, Account*
, BSTree::Node*const
)
object type is: const BSTree
It's saying the argument type is Account *
but I have it as Account *&acct
.
First parameter is object to retrieve. Second holds pointer to found object.
Here's the code:
bool BSTree::Retrieve(int ID, Account *&acct, Node *leaf)
{
if(leaf != NULL)
{
if(ID == leaf->pAcct->getID())
{
acct = leaf->pAcct;
return true;
}
if(ID < leaf->pAcct->getID())
{
return Retrieve(ID, acct, leaf->left);
}
else
{
return Retrieve(ID, acct, leaf->right);
}
}
else
{
acct = NULL;
return false;
}
}
bool BSTree::Retrieve(int ID, Account *&acct) const
{
return Retrieve(ID, acct, root);
}