Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Interfaces cannot be called directly

Calling an interface-typed variable directly like myInterface() is invalid and instead a concrete method must be called, e.g. myInterface.foo().

Invalid

INTERFACE IA
    METHOD foo END_METHOD
END_INTERFACE

FUNCTION main
    VAR
        refIA : IA;
    END_VAR

    refIA();
END_FUNCTION

This also applies to qualified references and array elements:

THIS^.refIA();
refs[i]();

Valid

Specify the method name explicitly:

INTERFACE IA
    METHOD foo END_METHOD
END_INTERFACE

FUNCTION main
    VAR
        refIA : IA;
    END_VAR

    refIA.foo();
END_FUNCTION