template <class T>
void BT<T>::inOrder(void (*inOrderPtr)(T&))
{
inOrderPtr(inOrder(this->root));
}
template <class T>
void BT<T>::inOrder(Node<T>* root) const
{
if (root->left != NULL)
inOrder(root->left);
//something here
if (root->right != NULL)
inOrder(root->right);
}
Ok I am trying to create this Traversal via recursion. I actually posted this problem before but I was going about it wrong due to me having to use a function pointer. I don't understand what I'm suppose to do. I've got the public wrapper that calls on the private one... but the public one is the one with the function being passed in so what do I even do with it?? I feel retarded so even if someone were to give me a small hint I'm sure I'd get it. I just don't know where to go from here.
an example of a code that calls on it is this:
first.inOrder(print_val)