title: C++ Recursive Traversals with Function Pointers
body: <pre><code>template &lt;class T&gt;
  void BT&lt;T&gt;::inOrder(void (*inOrderPtr)(T&amp;))
   {
       inOrderPtr(inOrder(this-&gt;root));
   }
  template &lt;class T&gt;
  void BT&lt;T&gt;::inOrder(Node&lt;T&gt;* root) const
   {
      if (root-&gt;left != NULL)
         inOrder(root-&gt;left);
         //something here
      if (root-&gt;right != NULL)
         inOrder(root-&gt;right);
   }
  </code></pre>
  
  <p>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.</p>
  
  <p>an example of a code that calls on it is this:</p>
  
  <pre><code>first.inOrder(print_val)
  </code></pre>