Introduction to OOP: Chapter 15 : Case Study: Container Classes [previous] [audio] [real] [text]

Iterator Class

template <class T> class listIterator {
	ListIterator (Link<T> & sl) : currentLink(sl) { }
	void operator ++ () { currentLink = currentLink->nextLink; }
	T operator * () { return currentLink->value; }
	bool operator == (ListIterator<T> & right) { return currentLink == right.currentLink; }
private:
	Link<T> * currentLink;
};
Intro OOP, Chapter 15, Slide 19