I am trying to recreate a Deque in C++, and cannot figure out why next and prev aren't declared in the scope of Sentinel as follows:
template <typename T> class ANode {
public:
ANode<T> * next;
ANode<T> * prev;
};
template <typename U> class Sentinel: public ANode<U>{
public:
Sentinel(ANode<U> * n, ANode<U> * p) {
next = n;
prev = p;
next->prev = this;
prev->next = this;
}
Sentinel() {
next = this;
prev = this;
}
};