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
Schedule
Day 1
- Continue Inheritance (Ch19.5-19.9)
Todo:
Day 2
- Finish Inheritance (Ch19.10-19.14)
- Inheritance Design Activity
Todo:
- Do Ch 19 Exercises
Day 3
Todo:
- Start assignment
Day 4
- Start Containers and Algorithms Ch 21.1-21.3
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
- Start Containers and Algorithms Ch 21.1-21.3
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.
Containers and Algorithms
There are many ways to organize data in a program beyond just using a vector. C++ provides a number of built-in container types that implement common data structures (as do most other programming languages).
In addition, the C++ standard library provides a large number of algorithms that can be used to manipulate data in these containers.
Read Ch 21.1-21.3. We will cover the rest of Chapter 21 next week.
These optional videos may help:
std::lists (Ch 21.1):
Iterators and Traversal (Ch 21.2-3):