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

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 VAR and VAR_EXTERNAL sections; its methods have the inputs and outputs (6.6.5.2);
  • an access specifier stands on a CLASS’s or FUNCTION_BLOCK’s VAR section, not on its inputs, outputs or externals, nor on a method’s variables (6.6.5.10, 6.6.7.2.6);
  • EXTENDS of 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);
  • OVERRIDE on 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);
  • FINAL and ABSTRACT together; an ABSTRACT method in a type that is not ABSTRACT, with OVERRIDE, 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 a VAR_IN_OUT (6.6.5.8);
  • SUPER outside 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-typed REF_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 INTERFACE with 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); EXTENDS of an interface or IMPLEMENTS naming 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, a REF_TO a 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);
  • THIS outside 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 a VAR_IN_OUT instead (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.