Extending interfaces

Like function blocks, interfaces can also be extended. The interface then acquires the methods and properties of the basic interface, in addition to its own.

Here are the steps to create an interface that extends another interface:

1. Select the PLC project object or a subfolder in the PLC project tree.
2. In the context menu, select the command Add > Interface…
The Add Interface dialog box will appear.
3. Enter a name for the new interface.
4. Select the Advanced option, and click the Extending interfaces 1: button.
5. The Input Assistant dialog opens.
6. From the Interfaces category, select the interface that will be extended by the new interface.
The interface extends the basic interface.

 

Extending interfaces 2:

Multiple inheritance

In the PLC, multiple inheritance is generally permitted for interfaces. It is therefore possible for one interface to extend more than one other interface.

Example: INTERFACE I_Sub EXTENDS I_Base1, I_Base2

The TwinCAT type system and the ADS Watch Server do not support multiple inheritance for interfaces. With ADS access, only the methods and properties of the first basic interface are therefore visible.

See also: