ProgrammingAssignment-CheckedList

ProgrammingAssignment-CheckedList - Programming Assignment...

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

View Full Document Right Arrow Icon
Programming Assignment #3 Submit file - Due Thursday, February 15, 2007 at 10:30 am Hardcopy - Due same day at the start of class This assignment gives you another chance to implement a container interface, this time using linked lists. The interface will be very similar to the CheckedArray assignment. The primary difference is that this class will be implemented with a double linked list instead of an array. Because it’s a list, we won’t have to worry about the array becoming full and having to be resized. The task is to implement a templated class named CheckedList which clients can use as a container of any type. There is an additional feature of this class that lists don’t normally implement: subscripting. This will simulate “random access” to the elements in the list and provide a consistent interface with the CheckedArray class. The CheckedList class will also perform bounds checking on the indices provided by the client and throw an appropriate exception. The partial class definition is below: template < typename T> class CheckedList { public : struct Node { Node *Next; Node *Prev; T Data; }; private : unsigned size_; Node *head_; Node *tail_; // Other private fields and methods public : CheckedList(ObjectAllocator *Allocator = 0); CheckedList( const CheckedList &rhs); ~CheckedList(); operator= ( const CheckedList& rhs); T operator[] ( unsigned index) const throw (CheckedListException); T& operator[] ( unsigned index) throw (CheckedListException); void insert( const T& value, unsigned
Background image of page 1

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

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

Page1 / 2

ProgrammingAssignment-CheckedList - Programming Assignment...

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