Getting an error in g++ List.cc:19:1: error: âIteratorâ does not name a type
when . Header is the following
class List {
private:
class Element {
public:
char data;
Element *next;
Element *prev;
Element(Element *n,Element *p, char d);
};
Element *first;
public:
class Iterator {
public:
Iterator();
void operator++();
void operator--();
char& operator*();
const char& operator*() const;
bool operator==(const Iterator& itr);
bool operator!=(const Iterator& itr);
private:
Iterator(const Element& ele);
Iterator *it;
};
List();
~List();
Iterator& begin() const;
Iterator& end() const;
void insert(Iterator itr, char c);
void erase(Iterator itr);
};
Line 19 is:
Iterator& List::begin() const
Is this an inheritance issue? I am trying to call iterator in the main function just like a std::list via List::Iterator