All Classes Are Derived from Class object
All classes, except the special class
Classes without a class-base specification are implicitly derived directly from class
Other important facts about class derivation are the following:
Lets go back to our
object
, are derived classes, even if they don’t have a class-base specification.
Class object
is the only class that is not derived, since it is the base of the inheritance hierarchy.
Classes without a class-base specification are implicitly derived directly from class
object
. Leaving off the class-base specification is
just shorthand for specifying that object is the base class.
Other important facts about class derivation are the following:
- A class declaration can have only a single class listed in its class-base specification. This is called single inheritance.
- Although a class can directly inherit from only a single base class, there is no limit to the level of derivation. That is, the class listed as the base class might be derived from another class, which is derived from another class, and so forth, until you eventually reach object.
Lets go back to our
employee
class in previous example, the actual class hierarchy is shown in following figure:
0 comments:
Post a Comment