CS 70

Lesson 1

  • LHS Cow speaking

    We've learned about object lifetime and dynamically allocated memory on the heap.

  • RHS Cow speaking

    Today, we're going to put the two together by exploring what happens when an instance of a class can manage its own dynamically allocated memory.

  • LHS Cow speaking

    This lesson also gives you a chance to get more practice working with pointers!

This lesson addresses aspects of the following course learning goals in Group 5:

  • Goal 5A: Model Objects:
    • Draw memory models for classes that allocate memory on the heap
  • Goal 5D: Constructors and Destructors:
    • Write constructors, destructors, and assignment operators, including for classes that allocate memory on the heap.
    • Use the keywords default and delete to control if and how those functions will be synthesized by the compiler.

Outline

(That's a pretty good chunk of material. Consider taking a breather here.)

(Woo-hoo, we have a working class that can be used! This is another good time for a stretch, maybe some fresh air…)

To receive credit: complete all pages above, then this page will be complete as well (and get a green check emoji at the bottom right of the page).

(When logged in, completion status appears here.)