template <typename Object>
void LinkedStack<Object>::~LinkedStack() {
while (head != NULL) {
Node* old = head;
head = head->next;
delete old;
}
}
template <typename Object>
void LinkedQueue<Object>::size() const {
int count=0;
if (cursor != NULL) {
Node* walk = cursor->next;
count++;
while (walk != cursor) {
walk = walk->next;
count++;
}
}
return count;
}
As it turns out, the class would function perfectly well with
the simplification. There are two issues worth noting. First,
in the case where