For example, suppose that in the vessel example, you sometimes want to supply the label to be pasted onto a flask, and other times want a default label. You could define a second
fill method on flask.
|
Sterilize the flask, execute call next method to fill the flask, than paste the label on the flask.
|
With both
fill methods defined, G2 counts the arguments each time you invoke fill on a flask, and selects the fill method that has that number of arguments. Duplicate and Superior Methods
When you use call next method in a duplicate method, you must make sure that the superior method is also duplicated, or G2 will not invoke it because it has the wrong number of arguments. For example, the two-argument flask::fill in the preceding example would not work correctly unless a two-argument vessel::fill existed also.call next method to invoke the correct superior method. Trying to call it directly may invoke the wrong method, as in the case of duplicate procedures, resulting in an error due to mismatched argument lists. For further information, see Duplicate Procedure Names.