For a language to be object-oriented it must at least include
the following three capabilities
Encapsulation
The ability to define a new type and a set of operations on
that type, without revealing the representation of the type.
C++ classes support encapsulation by restricting access to
private data members.
Inheritance
The ability to create new types that inherit properties from
existing types. C++ support inheritance through a
mechanism known as class derivation.
Polymorphism
The ability of objects that belong to related classes to
respond differently to the same operation. In C++ virtual
functionssupport polymorphism.
Thus we now need to look at class derivation and virtual
functions.
|