
// File name:  ListItr.h

#ifndef LISTITR_H
#define LISTITR_H

template <class Object>
class ListItr
{
   public:
      ListItr ( ) : current ( NULL )
      {
      }
 
      bool isPastEnd ( ) const
      {
         return ( NULL == current );
      }

      void advance ( )
      {
         if ( !isPastEnd() )
            current = current->next;
      }

      const Object & retrieve ( ) const
      {
         return current->element;
      }

   private: 

      ListNode<Object> * current;     // current position
 
      ListItr ( ListNode<Object> * theNode ) : current ( theNode ) { }

      friend class List<Object>;      // grant access to constructor
};

#endif
