When calling Node Counting function in public I get incompatible declaration and in private my returns do not match the function and I cannot call in the test driver.
Float, int, void, bool(stupid I know).
CPP
void BinaryTree::count(TreeNode* root) {
if(root == NULL)
return 0;
else
if(root->left == NULL && root->right == NULL)
return 1;
else
return count(root->left) + count(root->right) + 1;
}
Header (I think I need to make this public so I can call in the test driver but I was only able to declare in the CPP from Private.)
void count(TreeNode *);
Driver
cout << "Total Number of Nodes " << endl;
tree.count();
cout << endl;
In the Driver test CPP tree.count is inaccessible which is understandable because its being called from private, but as a public call the declaration is incompatible.