The implementation of interfaces is based on the concept of object-oriented programming. Using shared interfaces, you can implement different but similar function blocks in a similar way.
A function block which implements an interface must implement its own code for all methods and properties defined with this interface.
When you define a new function block which implements an interface, the methods and properties of this interface are automatically inserted below the new function block in the object tree. However, not all methods and properties are inserted, but only those which are required for an error-free compile.
If you add more methods to an interface at a later time, then these methods are not automatically included in the declaration of the function blocks which implement the interface. In order to update the implementation there, you need to call the ⮫ Implement Interface command. To override individual methods, select the Add Object → Method command. The dialog opens with a list of all overridable methods. For a selection, click in the Name list box.
In the case of derived function blocks, you need to make sure that methods or properties, which are inherited from an interface via EXTENDS, are correctly implemented. When no custom implementation is provided, the function block automatically uses the basic implementation of the superordinate or a related function block.
For more information, see the following: ⮫ Updating an interface, ⮫ Method
-
Using interface variables
-
Implementing an interface in a new function block
-
Implementing an interface in an existing function block
-
Updating an interface
-
Overriding methods