Virtual Methods

CTRL++ provides the possibility to define pure virtual methods in a base class. This requires that this method is implemented in derived child classes

The script editor checks (syntax check), that the new rule is followed.

If a method is marked with the virtual keyword e.g. virtual myVirtuMethod(); you can save a method without an error even if no function logic has been implemented yet.

If a child class derives from the base class, but does not implement the method virtual myVirtuMethod();, the CTRL Editor shows a warning in the log-viewer.

This allows you to see easier that a method must be implemented by derived classes and you can now define actual interface classes.

Note: When you update from the WinCC OA version 3.19 to 3.20, note that virtual is a reserved keyword and must not be used as a variable or method name. Take care that virtual is not used as a variable or method name in your code.