E0031: a class, method, interface, THIS or specifier where Ed.3 does not allow it
Ed.3’s object orientation (6.6.5 to 6.6.7) puts each of its parts in one place; this one is somewhere else:
- a CLASS declares only
VARandVAR_EXTERNALsections; its methods have the inputs and outputs (6.6.5.2); - an access specifier stands on a CLASS’s or FUNCTION_BLOCK’s
VARsection, not on its inputs, outputs or externals, nor on a method’s variables (6.6.5.10, 6.6.7.2.6); EXTENDSof a type that cannot be the base: a CLASS extends a CLASS, a FUNCTION_BLOCK a FUNCTION_BLOCK or a CLASS (Table 48 row 6); not a FINAL one (6.6.5.5.4); not the type itself, directly or not (6.6.5.5.5, error 3);OVERRIDEon a method that has no base method to override (6.6.5.5.5, error 4); an override whose result, inputs, outputs or in-outs differ from its base method’s, or whose access does (6.6.5.5.3); an override of a FINAL method;- a method with the name of a base method and no
OVERRIDE: write it (OO.md D6); FINALandABSTRACTtogether; anABSTRACTmethod in a type that is not ABSTRACT, withOVERRIDE, or with statements (OO.md D12); an ABSTRACT type without an abstract method, a type that leaves one it inherits unimplemented and is not ABSTRACT, and an instance of an ABSTRACT type other than aVAR_IN_OUT(6.6.5.8);SUPERoutside a derived type;SUPER.m()of an ABSTRACT method;SUPER()in a method, of a CLASS (which has no body), with arguments, in a loop, or a second time (6.6.7.2.9);- a derived instance given to a base-typed
VAR_IN_OUT, or referenced by a base-typedREF_TO, when its type adds an in-out: a call through the base would leave it unbound (6.6.8.3; OO.md D7); - an
INTERFACEwith variables, or a method of one with an access specifier, FINAL, ABSTRACT, OVERRIDE, statements, or sections other than inputs, outputs and in-outs (6.6.6.1);EXTENDSof an interface orIMPLEMENTSnaming what is not an interface, or an interface its own base (6.6.6.3, 6.6.6.4); - a type that implements an interface’s method with another result or other parameters, or neither PUBLIC nor INTERNAL (6.6.6.4.2; OO.md D10); one that leaves a method out and is not ABSTRACT;
- an interface as a
VAR_IN_OUT(6.6.6.2; OO.md D9), or at an address: it references an instance, and is declared as an input or a variable; ?=other than an interface from an interface, aREF_TOa CLASS or FUNCTION_BLOCK from an interface, or such a reference from a reference to its base or a type derived from it (6.6.6.7);THISoutside a method or a function block’s body (6.6.5.7.2);- an instance of a CLASS, or of a FUNCTION_BLOCK with methods, a base,
a derived type or an interface, copied
with
:=, made an input or output, or a variable of a FUNCTION or a method: it is passed as aVAR_IN_OUTinstead (OO.md D11). A copy would cut a derived instance down to its base. An array or a structure that holds one, anywhere in it, is refused the same way: it would be copied with it.