Click here to Skip to main content
12,357,063 members (76,310 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C++
 how can i handle this error
argument of type "Node<int> *" is incompatible with parameter of type "BinarySearchTree<int> *"
Posted 9-Nov-12 20:39pm
Edited 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);
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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 | :laugh:
  Permalink  
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 :)
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160621.1 | Last Updated 10 Nov 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100