Vai al contenuto

Implementing Interfaces

The methods prototype of an interface can be implemented by a function block.Upon creation of the function block, or editing its properties, you can specify one or more interfaces in the Implements field; the interface and its methods will appear in the project tree as subelements of the Function Block that implements them. Implementing Interfaces-image_0In the example of the above picture, fb_class_2 implements intf_1; and intf_1 extends intf_2.In order to implement a method prototype of an interface, you need to create a method which has the same prototype (name and input variables) of the method prototype you wish to implement. Compiling a project with method prototypes not correctly implement- ed, will raise errors.To implement a method prototype you can create a new method (see paragraph 6.7.2.1) which has the same prototype of the method you wish to implement, or you can right-click on the method prototype and select Implement method; this way a new method will be created, already with the correct prototype.Method prototypes can have different icons, with different meaning:method prototype correctly implemented. Implementing Interfaces-image_0there is a method with the same name but different prototype from the one you wish to implement. Implementing Interfaces-image_0no method has been found with the same name of the method prototype you wish to implement. Implementing Interfaces-image_0the previous icons can also have a blue arrow on their right side, that means the method prototype is inherited from a different interface Implementing Interfaces-image_0