listtools

listtools - Node* next; friend class List; friend class...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
/** @file listtools.h @author William Duncan @date 2005-10-01 Description: Interfaces for the node class, iterator class - auxillary classes used in the list implementation. Course: CS1254.02 Logon ID: cs1254xx Lab #: 5 Instructor: William Duncan */ /* YOUR TASK: templatize these classes so that it works with any arbitrary type. As defined now, they work with only strings. */ #ifndef LISTTOOLS_H #define LISTTOOLS_H #include <string> #include <iostream> #include <cassert> using namespace std; /* Forward declaration */ class List; class Iterator; class Node { public: /* Constructs a node with a given data value. @param s the data to store in this node */ Node(string s); private: string data; Node* previous;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Node* next; friend class List; friend class Iterator; }; class Iterator { public: /** Constructs an iterator that does not point into any list. */ Iterator(); /** Looks up the value at a position. @return the value of the node to which the iterator points */ string get() const; /** Advances the iterator to the next node. */ void next(); /** Moves the iterator to the previous node. */ void previous(); /** Compares two iterators @param b the iterator to compare with this iterator @return true if this iterator and b are equal */ bool equals(Iterator b) const; private: Node* position; Node* last; friend class List; }; #endif...
View Full Document

This note was uploaded on 01/17/2012 for the course CSC 1254 taught by Professor Blanks,l during the Fall '08 term at LSU.

Page1 / 2

listtools - Node* next; friend class List; friend class...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online