Getting to know objects
So far, we have demonstrated how to create function blocks and how to add methods to them. However, in terms of actual implementation, we haven’t fully explored how to leverage these to do anything productive. A key use case for function blocks is reducing code for things that are similar. In other words, suppose we have a blueprint for a car. From that blueprint, we can create an unlimited number of vehicles from that single set of prints; however, each vehicle will be unique regarding certain values such as car color, VIN, or gas mileage.
In a more technical sense, an object is an instance of a function block. That is, each object you create will consist of all the attributes of the function block, such as the variables and methods, but they are independent of each other. For example, if a function block has a variable called MPG in it and has two objects that derive from it, one object can have an MPG value of 31 while another will have a value...