Overloading with ANY
- Last UpdatedOct 21, 2022
- 1 minute read
As with PML functions, the type of a method argument may be specified as ANY. If method overloading is being used, PML will invoke the method with a matching set of explicitly-typed arguments in preference to calling a method with arguments of type ANY, irrespective of the order the methods appeared in the object definition file:
define method .SetValue( !Argument Is ANY)
define method .SetValue( !Argument Is REAL)
Then:
!SomeObject.SetValue(100)
This will invoke the method with the REAL argument, but:
!SomeObject.SetValue(‘Priceless’ )
will invoke the method with the ANY argument.