CS 211:
Introduction to Computer Programming II
Instructor: Brian M. Dennis
Teaching Assistants:
Tom Lechner, Bin Lin, Rachel Goldsborough
http://www.cs.northwestern.edu/~bmd/cs211/

Inheritance

Inheritance

Inheritance

Inheritance
// Just for completeness' sake
void Car::display() {
cout << producer << "["
<< vin << "]" << endl;
}

Inheritance

Inheritance

Inheritance

Inheritance

Inheritance

An Inheritance Example

Builtin string class
char* strings are lame
Can't hold null characters
Can be conflated with a pointer to a single char
Can't directly compare
Small library of operations
No bounds checking
string class fixes many of the problems

That’s a Wrap
Takeaway
Inheritance promotes reuse
Interface
Data structuring
Implementation code
Reading
9.1 – 9.5