Others have answered how to solve the error you're seeing, but your question
Do I need a virtual destructor in the abstract Iterator base class?
has not been answered.
The answer is it depends on how you (and other users) intend to use these classes. There's nothing wrong with not having a virtual
destructor and everything will work correctly until someone decides to delete
an instance of LinkedListIterator
through an Iterator
pointer. For example:
Iterator<int> *iter = new LinkedListIterator<int>(...);
delete iter; // undefined behavior if Iterator destructor is not virtual
But since you're implementing an iterator class, the chances of someone dynamically allocating an instance, let alone attempting a polymorphic deletion on it, should be minimal. However, since you've already got other virtual functions, I can't think of a downside to declaring the destructor virtual
either.