-

Object-oriented Programming

PLCnext Engineer supports object-oriented programming by the use of function block methods and namespaces.

Function block methods

Methods define actions within the instance of a function block. By adding a method to a user-defined function block POU, the function block is defined as an object-oriented function block. Similar to function POUs, methods do have a result type, a variable declaration part and one or more code worksheets. Access to methods within a function block is controlled by access specifiers. Using access specifiers, you can limit from where the method may be called. For example, with the access specifier 'Private' the method can only be called from inside the POU where the method is defined.

Further Info
For detailed information on methods and their use, see the topic "Methods of FBs in PLCnext Engineer".

Namespaces

Namespaces allow you to organize and group POUs and user-defined data types to make them unique within the PLCnext Engineer project. By using namespaces you can have more than one language element with the same name in your project, thus avoiding naming conflicts.

Further Info
For detailed information, see the topic "Namespaces".