Week 3 - Pointers & Objects, Aggregation

Learning objectives

Upon finishing this week, you should be able to:

  • Write code that uses pointers and references
  • Use aggregation to build objects from other objects
Quiz 1 is open this Thurs-Saturday. It covers weeks 1 and 2.

Suggested pacing

Day 1

  • Pointer review

Day 2

  • Pointers & Objects
  • Aggregation
  • Do Aggregation CPPLab

Day 3

  • Aggregation Wrapup and this

Day 4

  • Quiz 1
  • Git Tutorial - follow the instructions in parts 2/3 to make your own cs162 repository and add some files to it.

Online Activity Outline

Pointers Review

Review 11.1-11.2 which should be a review from 161. Rewatch this video if you don't feel confident about pointers and memory addresses:

Then read 11.3-11.4 and 11.6-11.7. This material expands on the basics from 161.

Watch this video (related code is in the Github repository):

Do the Pointer Worksheet from the Files area in elearn - it is similar to the one from CS161 but has more problems. Start by reading the PointerWSExample file - it shows you how you should record the effects of lines of code. Use the PointerWSKey to check your work.

Pointers and Objects

Read 11.10.

Watch this video:

Aggregation

Read learncpp.com Ch 16.3 for the ideas behind aggregation—don't worry too much about the Teacher/Department sample they use; though the idea makes sense, their example is too stripped down to be informative. (Book Ch10.8 also talks about it, but in a very limited way).

Watch this first video. It focuses on the basics for this week's assignment.

Do the Aggregation CPPLab.

This second video looks at using aggregation to model relationships between people and to navigate those relationships. It should give you an idea about how to attack parts of this weeks assignment.

Using this

Read 11.11.

Watch this video on a couple tips about using this:

Quiz

Quiz 1 will be open in elearn Thursday through Saturday. The topics include weeks 1 and 2 (Ch 9/10 + Unit Testing & Test Driven Development). You are not responsible for 10.1/10.2 (string stuff) on the quiz.

To practice, go to the Resource Links and look for "Book author's website". On the author's website, look for the Quiz tab:

Sample quiz questions

The practice questions are based on the third edition of the book, so later chapters may be numbered slightly differently, but the questions are still great practice. Use the topic headings to find the sections that correspond to the material we have studied.

Git - Setup Your Own Repository

In week 2 we introduced source control so that you could access my code. Now is a good time for you to set up your own repository for your code. Doing so (and using it) means you will be able to always access your code wherever you are.

Follow the instructions in parts 2 and 3 of the Git Tutorial to make your own CS162 repository and add some files to it.