Element: Class
A class is a logical unit with encapsulated data and operations. It also represents a variable type that can be instantiated. When the instance of a class is assigned as a variable to another class, this is referred to as the role or expression of the class.
A class can provide a method FB_Init
which is called when initializing an instance.
A class can inherit from another class. This relationship is called a generalization.
A class can instantiate another class. This relationship is called a composition.
A class can recognize another class. This relationship is called an association.
A class can be a POU, a library POU (type: program), a function block, or a function.

(1) | Command icons TipWhen a class is selected, its command symbols are visible. |
(2) | Header
|
(3) | List of attributes The entry has the following format: Example: ID:
|
(4) | List of operations (actions, methods, or properties) Example:
An entry for methods has the format:
In the case of an entry for an An entry for actions has the format:
The following applies for <label>:
|
Properties
Identifier | Name of the class Example: |
User input
The class has expanded attribute and operation lists that are identified with . Command icons are visible above the class. You can use these to insert relationship elements.
Action | Result | |
---|---|---|
In the | The TipAfter being deleted, the class is displayed in the ToolBox view in Incoming cross references or Outgoing cross references. The requirement for this is that you select an element in the class diagram that has a relationship to the deleted class. | |
Click the | The | |
The | A composition arrow points from the new The class has been extended by the declaration of a function block instance of the first class. FUNCTION_BLOCK NewClass VAR_INPUT END_VAR VAR_OUTPUT END_VAR VAR InstanceBase : BaseClass; END_VAR | |
| A composition arrow points from the second class to the first class. The second class has been extended by the declaration of a function block instance of the first class. FUNCTION_BLOCK SecondClass VAR_INPUT END_VAR VAR_OUTPUT END_VAR VAR InstanceBase : BaseClass; END_VAR | |
The new | An association arrow points from the new class to the first class. The first The FUNCTION_BLOCK NewClass VAR_INPUT END_VAR VAR_OUTPUT END_VAR VAR ptrBase : POINTER TO BaseClass; END_VAR | |
| An association arrow points from the first class to the second class. The first class recognizes the second class. The first class has been extended by the declaration of a pointer to the second class. FUNCTION_BLOCK SecondClass VAR_INPUT END_VAR VAR_OUTPUT END_VAR VAR ptrBase : POINTER TO BaseClass; END_VAR | |
A new class is generated which inherits from the first class. | A generalization points from the new class to the first class. The new class inherits from the first class. The declaration of the new class has been generated with FUNCTION_BLOCK ClassNew EXTENDS BaseClass VAR_INPUT END_VAR VAR_OUTPUT END_VAR VAR END_VAR | |
| A generalization points from the first class to the first class. The declaration of the second class has been generated with the extension of the first class.
| |
An interface is generated which is implemented from the outgoing class. | An implementation arrow points from the class to the new Now the class implements the new interface. The declaration of the class has been extended with the implementation. FUNCTION_BLOCK BaseClass IMPLEMENTS ITF_New VAR_INPUT END_VAR VAR_OUTPUT END_VAR VAR END_VAR | |
The interface is implemented by the class. | A realization arrow points from the class to the interface. The declaration of the class has been extended with the implementation of the interface. FUNCTION_BLOCK BaseClass IMPLEMENTS ITF_A VAR_INPUT END_VAR VAR_OUTPUT END_VAR VAR END_VAR | |
| The object name (in the device tree or in the POUs view) has been automatically adapted in the declaration. | |
| The change is applied in the project synchronously and automatically. | |
Double-click the class element. | The corresponding object editor opens. |
Examples

FUNCTION_BLOCK Fb_D VAR VarFb_A: Fb_A; ... END_VAR

FUNCTION_BLOCK Fb_A VAR Class_2 : POINTER TO Class_2; END_VAR

FUNCTION_BLOCK Fb_A EXTENDS Fb_Base

FUNCTION_BLOCK Class_A IMPLEMENTS Itf_A