Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Re: Binary Sear...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 45762 of 47032
Post > Topic >>

Re: Binary Search Tree

by "Victor Bazarov" <v.Abazarov@[EMAIL PROTECTED] > May 5, 2008 at 04:42 PM

pleatofthepants wrote:
> I have a Binary Search Tree and a function called inOrder
>
> void inOrder (TreeNode<T>*, ostream& out)

I take it that your function is stand-alone, right?

> which is being called like this: a.inOrder(cout);

In order to be callable with the '.' syntax, the function needs to be
a member.

> But it will not work because the parameters are not the same. The
> function call has to be the same but what can I change in the function
> to allow this?

You need to put the function in the 'TreeNode' class template and
refactor it so that it uses 'this' instead of the first argument.

V
-- 
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
 




 2 Posts in Topic:
Binary Search Tree
pleatofthepants <aaron  2008-05-05 13:39:19 
Re: Binary Search Tree
"Victor Bazarov"  2008-05-05 16:42:23 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 21:13:38 CDT 2008.