Click here to Skip to main content
12,954,403 members (60,229 online)
Rate this:
Please Sign up or sign in to vote.
See more:
 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
Updated 9-Nov-12 20:44pm
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
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:
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
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
Top Experts
Last 24hrsThis month
OriginalGriff 6,524
CHill60 3,490
Maciej Los 3,123
ppolymorphe 2,030
Jochen Arndt 1,975

Advertise | Privacy | Mobile
Web01 | 2.8.170525.1 | Last Updated 10 Nov 2012
Copyright © CodeProject, 1999-2017
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