Main Page

Previous Page
Next Page

[Page 633]

Chapter 12. Object-Oriented Programming: Inheritance

Say not you know another entirely, till you have divided an inheritance with him.

Johann Kasper Lavater

This method is to define as the number of a class the class of all classes similar to the given class.

Bertrand Russell

Good as it is to inherit a library, it is better to collect one.

Augustine Birrell

Save base authority from others' books.

William Shakespeare


In this chapter you will learn:

  • To create classes by inheriting from existing classes.

  • How inheritance promotes software reuse.

  • The notions of base classes and derived classes and the relationships between them.

  • The protected member access specifier.

  • The use of constructors and destructors in inheritance hierarchies.

  • The differences between public, protected and private inheritance.

  • The use of inheritance to customize existing software.

[Page 634]


12.1 Introduction

12.2 Base Classes and Derived Classes

12.3 protected Members

12.4 Relationship between Base Classes and Derived Classes

12.4.1 Creating and Using a CommissionEmployee Class

12.4.2 Creating a BasePlusCommissionEmployee Class Without Using Inheritance

12.4.3 Creating a CommissionEmployee-BasePlusCommissionEmployee Inheritance Hierarchy

12.4.4 CommissionEmployee-BasePlusCommissionEmployee Inheritance Hierarchy Using protected Data

12.4.5 CommissionEmployee-BasePlusCommissionEmployee Inheritance Hierarchy Using private Data

12.5 Constructors and Destructors in Derived Classes

12.6 public, protected and private Inheritance

12.7 Software Engineering with Inheritance

12.8 Wrap-Up



Self-Review Exercises

Answers to Self-Review Exercises


Previous Page
Next Page