The parent()
function is not letting the code compile; I don't know what's wrong. The compiler is saying: expected a qualified name after typename
.
The constructor is working however. How to fix this?
template<typename T>
class Node {
public:
//accessors
Node<T>* parent() const;
private:
T Data;
Node<T>* Parent;
std::vector<Node<T>*> Children;
};
template<typename T>
Node<T>::Node(T const & data){
this->Data = data;
}
template <typename T>
typename Node<T>* Node<T>::parent() const {
return this->Parent;
}