C++ Programming Guide

Object-Oriented Features

The class, the fundamental unit of data abstraction in C++, contains data and defines operations on the data.

A class can build on one or more classes; this property is called inheritance, or derivation. The inherited class (or parent class) is called a base class in C++. It is known as a super class in other programming languages. The child class is called a derived class in C++. It is called a subclass in other programming languages. A derived class has all the data (and usually all the operations) of its base classes. It might add new data or replace operations from the base classes

A class hierarchy can be designed to replace a base class with a derived class. For example, a Window class could have, as a derived class, a ScrollingWindow class that has all the properties of the Window class, but also allows scrolling of its contents. The ScrollingWindow class can then be used wherever the Window class is expected. This substitution property is known as polymorphism (meaning "many forms").

A program is said to be object-oriented when it is designed with abstract data types that use inheritance and exhibit polymorphism.