Click here to Skip to main content
11,645,087 members (67,099 online)
Rate this: bad
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
FatimaAsif at 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 at 10-Nov-12 2:41am
the line where i get error is
Rate this: bad
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:
FatimaAsif at 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 at 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 at 10-Nov-12 3:36am
yes now i realize it :)
Rate this: bad
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.

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

  Print Answers RSS
0 OriginalGriff 700
1 494
2 Sergey Alexandrovich Kryukov 449
3 Afzaal Ahmad Zeeshan 444
4 CPallini 426
0 OriginalGriff 1,065
1 Sergey Alexandrovich Kryukov 703
2 Afzaal Ahmad Zeeshan 702
3 DamithSL 681
4 CPallini 595

Advertise | Privacy | Mobile
Web02 | 2.8.150731.1 | Last Updated 10 Nov 2012
Copyright © CodeProject, 1999-2015
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