Object Oriented Programming - C++

Inheritance - C++

Inheritance is the ability of a class to inherit features of one or more other classes. That is, inheritance is achieved by creating a new or derived class from at least one exisiting class. The existing class sometimes is called the base class, and the new class is called the derived class.


Inheritance pertains to class, and not to ordinary non-class variables and functions. In practice programs do inherit. For example, programs inherit windows, screens, and such gadgets. In an integrated environment the main screen for a Spreadsheet is thesame across the board for the Wordprocessor and the Database programs. This comes as result of one application inheriting features that they have in common.


Charateristics of Inheritance

Base and Derived Classes
As was mentioned, inheritance is achieved by creating a new or a derived class from at least one exisiting class. The format for class derivation follows the following pattern:

class Derived: access_specifier Base1, access_specifier Base2, …. {
// Code for the derived class };

Access specifier can either be:


Analysis


Demonstrations Programs
Inheritance I: Introduction
Inheritance II:Private vs Public Members
Inheritance III Protected Members
Inheritance IV Constructors and Destructors
Inheritance IV class: A Data Type
Inheritance IV Derived class initializes Base class constructor
Inheritance I: Go Back to the Schedule