Try OpenEdge Now
skip to main content
Object-oriented Programming
Designing Objects: Inheritance, Polymorphism, and Delegation : Interface hierarchies and inheritance : Multiple interfaces in a hierarchy
 

Multiple interfaces in a hierarchy

Each class implementing an interface is required to implement all members of the interface. However, a class inheriting from a class already implementing the same interface also inherits all of the implementations. Thus you need not explicitly implement the members.
Interface inheritance allows the same interface to appear multiple times within an interface hierarchy. That is, it is valid for an interface to inherit member prototypes from an interface that it already inherits from.
For example:
INTERFACE IMyX :
INTERFACE IMyY INHERITS IMyZ :
INTERFACE IMyZ :
INTERFACE IMyA INHERITS IMyX, IMyY, IMyZ :
The following figure depicts the interface hierarchy where interface IMyZ is inherited by both interface IMyY and IMyA.
Figure 9. Multiple Interfaces in hierarchy
It is not an error having interface IMyZ appear twice in the hierarchy. It is however, a compile time error to have an interface appear within its own hierarchy.
For example:
INTERFACE IMyJ INHERITS IMyJ :
The above example results in a compile time error.