Exploring methods
To get the most out of a function block, you should add methods to it. Methods are a special type of function that are declared in and must be invoked through a function block. Where a standard method is globally accessible in a PLC program, a method can only be invoked in a file that references the function block, as we saw in the previous section. Another unique feature of a method is that when inheritance is invoked, function blocks can share certain methods with other function blocks. To start exploring methods, we’re going to add four methods to the Calculator function block we created in the last example.
Adding methods
Adding a method is relatively simple. To add a method, all you have to do is right-click the Calculator function block, hover over Add Object, and click Method…, similar to what is shown in Figure 4.3.

Figure 4.3: Adding a method
When you follow these steps, you will be met with a wizard that will generate...