Week 4: Vectors – dynamic arrays

SLOs for Week 4

Students will be able to…

  • recognize a copy constructor and implement it.
  • identify the 3 situations in which a copy constructor is called
  • reason about the difference between a shallow and deep copy of a data structure.
  • use the new operator to dynamically allocate memory and the delete and delete[] operators to free up the memory.
  • explain when C++ calls the destructor on an object.
  • explain when it is important to implement the destructor explicitly for a class.
  • understand the implementation of a dynamic array data structure, including how it adapts its internal size to accommodate the number of values in the array.
  • implement operator overloading for a class.

Slides, videos, and application exercises

Week 4: Slides

No readings for Week 4.

Lab 4: Vectors

Vec – A First Dynamic Data Structure

Project 4: Vec – A First Dynamic Data Structure

Vec – A First Dynamic Data Structure