Lab 14B: Linked Lists - Constructors, Copy Constructors & Destructors

  < Previous  Next >

Objectives:

In this lab, we will write the following routines for a pointer-based linked list class:

Background

The role of a constructor is to initialize all of the data members.
For a class with dynamically allocated memory, the role of a copy constructor is to make a deep copy of all allocated memory. For a linked list, this means copying the entire list.
For a class with dynamically allocated memory, the role of a destructor is to deallocate all remaining memory.

Assignment:

Write the constructor, copy constructor and destructor for a LinkedList class.

Submission

Submit your source code using the handin program. For handin, for this lab, type the following in a terminal window exactly as it appears:
handin  lab14B  LinkedList.h  LinkedList.cpp
To verify your submission, type the following in a terminal window:
handin  lab14B