UDMs support method name overloading in the same manner that UDFs support function name overloading: you can define several methods that have the same name but are different from each other in such a way to make each method unique.
The name that is overloaded is specified in the METHOD specification in the CREATE TYPE statement as the name to use to invoke the UDM. You must provide a unique C or C++ function for each UDM with the same name.
Characteristics of a Unique Method
- The number of parameters is different.
- The parameter data types are distinct from each other.
For the rules on which parameter data types are distinct from each other, see Parameter Types in Overloaded Functions.
Relationship to CREATE TYPE and CREATE METHOD Statements
The name that is overloaded is the name that immediately follows the METHOD keyword in the CREATE TYPE statement.
- A parameter list that satisfies the characteristics of a unique function
- A unique name in the SPECIFIC clause
Each time you use the CREATE METHOD statement to install an overloaded method, you must specify a different C or C++ function.
Calling a Method That is Overloaded
The rules that Vantage uses to determine which method to invoke when the method is overloaded are the same rules used to determine which function to invoke when a user calls a UDF that is overloaded.
For details, see Calling an Overloaded Function.
Using TD_ANYTYPE Parameters as an Alternative to Overloading Method Names
You can use TD_ANYTYPE parameters to reduce the number of overloaded methods needed to support routines that have constant parameter counts but differing parameter data types. TD_ANYTYPE parameters can accept any system-defined data type or user-defined type; therefore, you can create a single method that can support a multitude of data types.
For more information, see Using TD_ANYTYPE Parameters as an Alternative to Overloading Function Names.