Week 3 - Pointers & Objects, Aggregation

Learning objectives

Upon finishing this week, you should be able to:

  • Use objects as input and output for functions
  • Recognize how and when to appropriately use const and static class members
  • Use composition to build objects from other objects
  • Write unit tests for classes

Schedule

Day 1

  • Start Ch 17

Outside of class:


Day 2

  • Continue Ch 17

Outside of class:


Day 3

  • Finish Ch 17

Outside of class:

  • Finish Interacting Objects
  • Start the assignment. See Assignment section for a video that shows what the file structure and Makefile should look like.

Day 4

  • Pointers intro
  • Do this Pointer Worksheet and check your answers with this Pointer Worksheet Key to practice diagramming what is happening in memory as code does various operations involving pointers.

    This worked sample problem shows solving a pointer problem step by step.

    This is not a graded assignment, you do not have to turn it in. Do make sure you know how to do these style of problems... you will see similar ones on the midterm.

Outside of class:

  • Read the start of Ch 18 on Pointers (Ch18.1-18.5)

Day 1


Day 2


Day 3

  • Finish Interacting Objects
  • Start the assignment. See Assignment section for a video that shows what the file structure and Makefile should look like.

Day 4

  • Read the start of Ch 18 on Pointers (Ch18.1-18.5)
  • Do this Pointer Worksheet and check your answers with this Pointer Worksheet Key to practice diagramming what is happening in memory as code does various operations involving pointers.

    This worked sample problem shows solving a pointer problem step by step.

    This is not a graded assignment, you do not have to turn it in. Do make sure you know how to do these style of problems... you will see similar ones on the midterm.

Interacting Objects

Read Ch 17. It covers how to write code that involves multiple interacting objects. This includes passing objects to functions, returning objects from functions, and using objects as member variables of other objects (composition).

After you are through section 17.3 watch this video on using the debugger to track passed objects:

Important Video


Other Ch 17 Videos

These videos cover other topics from Chapter 17. They are not required, but you may find them helpful.

This video discusses const member functions. It also briefly reviews passing objects as const references. (17.1)

This video reviews const members. (17.2)

This video covers static members. (17.4)

This video covers Composition. (17.5-17.8)

This video covers object construction as part of composition. (17.9)


Assignment

This video walks through what the setup for this week's assignment looks like:


Pointers

Read Ch18.1-18.5 (we will cover the rest of Chapter 18 next week).

This video recaps 18.1-18.5: