Abstract Base Class

Do we need the word Base in this concept? Why not just AbstractClass?

From Webster's Revised Unabridged Dictionary (1913) [web1913]:

Abstract \Ab"stract` 1. ...
2. Considered apart from any application to a particular object; separated from matter; existing in the mind only; as, abstract truth, abstract numbers.

An abstract base class is a class that is "exists only in the mind".

Eh? As opposed to what? ALL classes exist in the mind, in the design, in the source code. Concrete (non-abstract) classes can also have instances that "exist" in memory.

You cannot ever directly create an object of a type that is abstract - they are only used as "parent" classes, or "base" classes.

In CeePlusPlus, a class that has any PureVirtual member functions is an abstract base class.

In JavaLanguage, any class which is declared "abstract" is an abstract class. Any classes which contain abstract (PureVirtual) methods (either directly declared, or inherited and not overridden) must be declared abstract; but the converse is not true -- an abstract class need not have any abstract methods.

Q:When is all of this useful? (See PolymorphismExample for the exciting conclusion!)

A:One way this can be useful is when one in ThinkingOutLoud, exposes the design which was previously "only in the mind". Another is to actually build and then utilize the class in a working program.


Related:


EditText of this page (last edited January 30, 2010) or FindPage with title or text search