Objectives
In this chapter you’ll:
• Learn qhat inheritance is and how it promotes software reuse.
• Understand the notions of base classes and derived classes and the relationships between them.
• Use the protected
member access specifier.
• Understand the use of constructors and destructors in inheritance hierarchies.
• Learn the order in which constructors and destructors are called in inheritance hierarchies.
• Understand the differences between public
, protected
and private
inheritance.
• Use inheritance to customize existing software.
11.2 Base Classes and Derived Classes
11.3 Relationship between Base and Derived Classes
11.3.1 Creating and Using a CommissionEmployee
Class
11.3.2 Creating a BasePlusCommissionEmployee
Class Without Using Inheritance
11.3.3 Creating a CommissionEmployee–BasePlusCommissionEmployee
Inheritance Hierarchy
11.3.4 CommissionEmployee–BasePlusCommissionEmployee
Inheritance Hierarchy Using protected
Data
11.3.5 CommissionEmployee–BasePlusCommissionEmployee
Inheritance Hierarchy Using private
Data
11.4 Constructors and Destructors in Derived Classes
11.5 public
, protected
and private
Inheritance
11.6 Software Engineering with Inheritance