Week 5 - Inheritance, Operators
Learning objectives
Upon finishing this week, you should be able to:
- Use inheritance to extend classes
- Identify appropriate uses for abstract classes
- Describe how virtual functions differ from regular ones and enable polymorphism
- Create classes that work using standard operators
Suggested pacing
Day 1
- Continue Inheritance (Ch19.5-19.9)
- Do Virtual Call Practice
Day 2
- Finish Inheritance (Ch19.10-19.14)
- Do Inheritance Design Activity
Day 3
- Midterm Review
- Do Ch 19 Exercises
Day 4
- Operator Overloading (Ch 20.1-20.8)
Activity Outline
Inheritance
You should have read 19.1-19.4 last week. This week we will finish up Chapter 19.
These optional videos may help:
Overriding functions (Ch 19.5):
Virtual Functions (Ch 19.7):
Object Slicing (Ch 19.8):
Abstract Functions and Classes (Ch 19.9-19.10):
Multiple Inheritance and Interfaces (Ch 19.11):
Composition vs Inheritance (Ch 19.13):
Virtual Call Practice
Below is a worksheet that has some practice problems on the material from 19.8.
Inheritance Design Activity
Below is a design activity. Tackle it after you have read through 19.12.
Midterm Review
The midterm will cover up through inheritance. Like the CS161 exams, the midterm will involve some writing code by hand, but it the code writing is focused on the core ideas, not all the possible syntax details. Unlike the CS161 exams, there will be questions that don't involve writing code, such as explaining ideas or designing a class.
Below is a review guide. It is not a sample test per se, but it has examples of the types of questions that might be on the midterm.
Operator Overloading Basics
Chapter 20 introduces operator overloading. (We are not doing the exercises, just the reading.)
This optional video gives an overview of the chapter: