template<typename T>
class tree {
protected:
std::vector<T> node_container;
public:
tree() {}
e ~tree() {}
virtual insert(T *node)=0;
};
template<typename T>
class binaryTree : public tree<T> {
public:
insert(T *node) {
if(node_container.empty()) ....
}
};
The code above gives me an error.
I cannot call node_container from the insert function declared in the binaryTree class.
The compiler says:
error: ‘node_container’ was not declared in this scope
I cannot see what is the problem with the polymorphism is. The binaryTree class is public to the tree class, and the node_container is within the protected statement. Is it the template class that prevent me to inheriting from the tree class?