Interfaces and inheritance

Instructor's Guide


introduction example types operations inheritance bindings
Interfaces define polymorphic object types. An interface may be realized by any object that supports the operations specified in the interface.

Interfaces and inheritance

Multiple (interface) inheritance


  interface A {  };
  interface B {  };
  interface C : A { };
  interface D : B, A { };
  

slide: Interfaces and inheritance

Interfaces can inherit from other interfaces. This results in augmenting the interfaces with the attributes and operations of the inherited interface. However, in contrast to class inheritance in C++, IDL does not allow for operations to be overridden, nor for overloading operations, that is different signatures for the same operation.

Multiple (interface) inheritance is supported however, provided that no clashes or overloading occurs.

The Object interface

Each object type defined in IDL may be assumed to be derived from the interface Object. For example, when defining an iterator type the interface may look as follows:
  interface iterator { 
iterator
Object next(); };
It is the responsibility of the implementation to downcast the object type to its actual type.