class Position { // position in NodeList
private:
NodePtr node; // pointer to the node
public:
Position(NodePtr n = NULL) // constructor
{ node = n; }
Object& element() const // return element
throw(InvalidPositionException) {
if (node == NULL) throw InvalidPositionException("Null position");
return node->element;
}
bool isNull() const // a null position?
{ return node == NULL; }
friend class NodeList<Object>; // allow access
};