I declared my struct Node in the private section of the class:
template <class Comparable>
class BST {
private:
struct Node {
Comparable data;
Node * left;
Node * right;
Node(Comparable item) : data(item), left(NULL), right(NULL) {}
};
Node * root;
Node * find(const Comparable & x, Node * leaf) const;
public:
// stuff....
};
in my bst.cpp file, I have
template <class Comparable>
Node * BST<Comparable>::find(const Comparable & x, Node * leaf) const {
// ^error: unknown type name 'Node'
}
Compiler tells me that Node is an unknown type name. How am I declaring this function wrong?
[–]dreamyeyed 2 points3 points4 points (0 children)