For every operation that you want to implement using methods, you must create a definition called a
method-declaration. This definition declares the name of the operation: every method that implements it for a particular class has this name.fill operation. This declaration would suffice for all fill methods on all classes, no matter how numerous the methods, or how the class hierarchy might be structured or restructured. If you also needed to implement an empty operation, you would need a second method declaration to define it; and so on for any number of operations.
To create a method declaration:
KB Workspace > New Definition > procedure > method-declaration
Names attribute to specify the name of the operation. You can use any available name.
fill operation used in the vessel example:![]() |
A method declaration can exist on any workspace. However, you can keep track of method declarations more easily if you store them systematically. One possibility is to keep them all on a workspace dedicated to that purpose. Another is to store each on the subworkspace of the highest-level class that uses the method.
Note: If you give a method declaration and a procedure the same name, and use that name in a call statement or a start action, you cannot predict whether G2 will invoke a method or the procedure. Avoid using the same name for both a method declaration and a procedure.
Flagging Call Next Method Requirements
Method declarations have one class-specific attribute: