Week 4 - Pointers & Objects, Aggregation
Learning objectives
Upon finishing this week, you should be able to:
- Write and trace code that uses pointers
- Use aggregation to build objects from other objects
Suggested pacing
Day 1
- Pointers (Ch18.1-18.5)
Day 2
- Finish Pointers (Ch18.6-18.7)
- Do Pointer Exercises worksheet after 18.6 or 18.7 (See Week 4 Module)
- Pointers & Objects (Ch18.8-18.9)
Day 3
- Aggregation (Ch18.10-18.14)
- Ch 18 Exercises
Day 4
- Work on assignment
- Start reading Inheritance (Ch19.1-19.4) we will be covering the rest of the chapter next week, but you should get a start on it now.
Activity Outline
Pointers
The first part of Chapter 18 covers the concept of pointers and then moves on to using pointers with objects.
This video recaps 18.1-18.5:
This next one demonstrates using the debugger in VS Code to examine pointer variables and the memory they point to. Watch it after you are done with 18.6.
Also at that point, take a few minutes to do the Pointer Exercises worksheet available in the Week 4 Module in Canvas. In the same location, you can find an example problem that is worked step by step as well as a key to check your work. You do not need to turn this in; it is just for practice.
Pointers and Objects
Ch 18.8-18.9 focus on using pointers with objects. This videos review those sections:
18.8:
18.9:
Aggregation
The last part of Chapter 18 covers aggregation, which is using objects as member variables of other objects.
These videos review sections on aggregation:
18.10-18.11:
18.12:
Finally, this video walks through the Ch 18.13 family tree example. It demonstrates using the VSCode debugger to examine the objects and pointers involved. So even if you understand the concepts without the video, it is worth a quick watch to see the debugging techniques.
Inheritance Basics
We will finish up Chapter 19 next week, but you should get a start on it now. The schedule for next week will assume you have read 19.1-19.4 this week.
This optional video review the basics of inheritance from those sections: