jkeys
jkeys

Reputation: 3955

Expected ctor

I am writing a delete member function for a Binary Search Tree. I have already written a boolean search function to return true/false based on whether it is in the BST. I have retooled it as a new function to return a Node* so that my delete function can call it and get a pointer directly to the correct Node.

Right now, I am getting a compile error on this line of code:

//"Expected constructor, destructor, or type conversion before '*' token
Node* BinarySearchTree::Search(int val);

struct Node is private to BinarySearchTree. I tried adding them as friends to each other, but that did not resolve the problem. Can anyone shed some light?

Upvotes: 1

Views: 135

Answers (1)

Pavel Minaev
Pavel Minaev

Reputation: 101585

You should qualify Node:

BinarySearchTree::Node* BinarySearchTree::Search(int val);

Upvotes: 4

Related Questions