Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ how to fix this error \"Allocating an object of abstract class type\" void c

ID: 3822986 • Letter: C

Question

C++ how to fix this error "Allocating an object of abstract class type"

void check (bool success) {if (success) cout NestedLessLess "Done" NestedLessLess end1; else cout NestedLessLess "Entry not in tree." NestedLessLess end1;}//end check int main() {Binary SearchTree* tree1Ptr = new Binary SearchTree(); tree1Ptr rightarrow add("10"); tree1Ptr rightarrow add("20"); tree1Ptr rightarrow add("30"); tree1Ptr rightarrow add("40"); tree1Ptr rightarrow add("50"); tree1Ptr rightarrow add("60"); tree1Ptr rightarrow add("70"); tree1Ptr rightarrow add("80"); cout NestedLessLess "Tree 1 Preorder: Should be 10 20 30 40 50 60 70 80 '; tree1Ptr rightarrow preorderTraverse(display);

Explanation / Answer

Hi Friend, You have not posted the whole program So I can not sure which calss is Abstract and which is Concrete.

But looking at code, you are creating object of BinarySearchTree class (the only one object you have created)

So, I can tell you, BinarySearchTree is Abstract class and there will be some implementation(child) class fot this class.

So, please create object of that class.

PLease let me know in case of any issue

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote