Click here to Skip to main content
15,885,435 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
 how can i handle this error
argument of type "Node<int> *" is incompatible with parameter of type "BinarySearchTree<int> *"
Posted
Updated 9-Nov-12 20:44pm
v2
Comments
FatimaAsif 10-Nov-12 2:41am    
i am making BST and root is declaire as Node* root in BST class and i have two classes Node and BST.
FatimaAsif 10-Nov-12 2:41am    
the line where i get error is
binTree->height(binTree->root);

You don't give us a lot of code to work with - just the one line - but I think you have painted yourself into a corner.

What I think is that binTree is declared as BST*, and root is delcared as Node* - you imply as much in your comments, so you can't assign a root value to binTree because a Node is not a BST.


If you are designing a binary tree, then normally the nodes such as Root, Next, and Previous are declared as BST* not as separate a separate class - otherwise you can't treat them as BST's when you get there.

I can't give you concrete code to fix it - I can't read your HDD or see your screen - but look at how you have defined things, and see if you can spot the logical problem! :laugh:
 
Share this answer
 
Comments
FatimaAsif 10-Nov-12 3:23am    
ok man next time i surely give more details so u can look at my problem deeply but thanks for this time
OriginalGriff 10-Nov-12 3:36am    
You're welcome - but do remember we only get to work with what you tell us, so the better your info, the better our response! :laugh:
FatimaAsif 10-Nov-12 3:36am    
yes now i realize it :)
hey i found its solution by myself actually i declared Node* root as private member that's why i can't access it in other class.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900