Contents Up << >>
What is an ABC ("abstract base class")?
At the design level, an ABC corresponds to an abstract concept. If you
asked a
Mechanic if he repaired Vehicles, he'd probably wonder what KIND-OF
Vehicle you
had in mind. Chances are he doesn't repair space shuttles, ocean
liners,
bicycles, or nuclear submarines. The problem is that the term "Vehicle"
is an
abstract concept (e.g., you can't build a "vehicle" unless you know what
kind
of vehicle to build). In C++, class Vehicle would be an ABC, with
Bicycle,
SpaceShuttle, etc, being subclasses (an OceanLiner is-a-kind-of-a
Vehicle). In
real-world OOP, ABCs show up all over the place.
As programming language level, an ABC is a class that has one or more
pure
virtual member functions (see next FAQ). You cannot make an object
(instance)
of an ABC.