Inheritance and Polymorphism
Much of the power of object-orientation comes from arranging classes in a hierarchy.
Classes that are:
-
Higher in the hierarchy represent more-general characteristics
-
Lower in the hierarchy represent more-specific characteristics
Inheritance enables new classes to be defined as subclasses (derived classes) of existing superclasses (base or parent classes).
The subclass automatically inherits the properties and methods (features) of the superclass. You can also define your own properties and methods for a subclass or reimplement existing superclass methods, to extend or modify the inherited behavior. You cannot reimplement conditions.
In JADE, a message can be sent to any object and the method that is executed depends on the class of the object to which the message was sent.
The ability of an object to respond differently to a specific message, depending on its type, is known as polymorphism; that is, it has the ability to assume several forms.
See also "Controlling the Use of Elements in Other Schemas", later in this chapter.