Lecture 9 Objectives
At the end of today's class you should
KNOW:
- How the bag functions are implemented in Chapter 4 (using a dynamically-allocated array to hold the bag items)
- Why a class that uses dynamically allocated memory must define a
copy constructor, an overloaded assignment operator, and a destructor
BE ABLE TO:
- Write a copy constructor for a class that uses dynamically allocated memory
- Write an overloaded assignment operator for a class that uses dynamically
allocated memory
Sample Exam Question:
Suppose there is no copy constructor defined for the bag class
implemented in Chapter 4.
Draw a picture and provide a short explanation of what can go wrong if a bag
object is passed as a value parameter to a function.