Chapter 13 Reading Assignment

Chapter 13 is very important and will introduce concepts that are new to most of you. Inheritance is a key concept in C++ and object-oriented programming.


New Keywords

protected, virtual

Section 13.1 - Inheritance

List a few examples of inheritance, or "is a", relationships in everyday life. List a couple of "has a" relationships. Don't steal my examples.

For your inheritance examples above, which class is the base class and which is the derived class

Section 13.2 - Protected

How are protected members of a class treated differently than private or public members?

Memorize the table on page 857 showing the impact of each base class access specification (private, protected and public) on class member of each access specification (private, protected and public). Start doing this by writing it down.

Section 13.3 - Constructors and destructors

In an inheritance relationship, whose constructor is called first, the base class or the derived class? Why is this?

In an inheritance relationship, whose destructor is called first, the base class or the derived class? Why is this?

What is the "special" syntax for passing arguments to a base class constructor from a derived class? Create your own bogus base and derived classes and show a simple example of this.

Section 13.4 - Overriding base class functions

What is the difference between overriding and overloading functions?

Section 13.5 through Section 13.7

These sections deal with polymorphism and how it is accomplished in C++. I think this stuff will be much easier to digest in class and lab, so that's where we'll focus on it. Scan these sections.

Section 13.8 - Classes derived from derived classes

Can classes be derived from already derived classes? Can you think of a 2-level inheritance relationship like this?

Section 13.9 - Multiple inheritance

How is multiple inheritance different multiple levels of derived classes shown in the previous section?

If a derived class has more than one base class, how is the order of constructor and destructor calls determined?

Section 13.10 - Composition vs. Inheritance

What is the difference between composition and inheritance? How are each accomplished in C++?