PreviousNext

The Interface Inheritance Operator

An interface definition can inherit properties of a previously defined interface, just as a C++ class can inherit properties of previously defined classes. You can modify an interface definition to inherit an interface by using the inheritance operator (J in the interface header, as follows:

[interface_attribute, …] interface interface_name [ : inherited_interface ]

This idl-generated header file contains the inherited interface's date types and interface class. The interface definition must also declare the information in the inherited interface's header file by using an import declaration in the body of the interface. The following example shows how the derived interface inherits another interface and imports that interface's definition file. The inherited interface definition file is named inherit.idl, and the interface it contains is named inherit.

Interface derived : inherit
{
import "inherit.idl";
.
.
.
}

An interface can inherit only one interface; that is, multiple interface inheritance is not allowed.