Object Oriented Programming¶
IEC 61131-3 Edition 3 (2013) added object-oriented programming to the standard. A function block type can declare methods, it can be derived from another by extension, one or more interfaces can describe a shared set of method signatures, and a type can be declared abstract when it is meant to be extended rather than instantiated directly.
This section documents the keywords that introduce these features. For the concepts behind them — inheritance, interfaces, and abstract types — see Object Oriented Programming.
Note
These keywords are recognized only when object-oriented syntax is enabled; otherwise each word is an ordinary identifier. See Enabling Dialects and Features for the flag and dialects reference.
Keywords¶
Keyword |
Description |
Support |
|---|---|---|
Derive a function block type or interface from a base type |
Function block: parsed and analyzed; what a derived type inherits is not yet compiled. Interface: parsed only |
|
Declare that a function block type provides one or more interfaces |
Parsed only |
|
Mark a function block type as not directly instantiable |
Parsed only |
|
Declare an interface — a named set of method signatures |
Parsed only |
|
Declare a method on a function block type |
Parsed, analyzed, compiled and executed for a method declared on
the instance’s own type; a method reached through |
|
Refer to the instance a method is running on, or to its base type |
Parsed only |
“Parsed only” means the syntax is accepted and the names it introduces are recognized, but the construct is not yet analyzed or executed — using it reports P9999. Each keyword’s page states exactly what it supports today.