ABL always searches for an exact parameter match, but if none is found, it will accept the closest parameter match according to widening in the available method or constructor overloads at compile time. Failure to find a match raises a compile-time error. For more information on matching parameter data types with widening, see the Parameter passing syntax reference entry in OpenEdge Development: ABL Reference.
The examples that follow show how widening can resolve calls to overloaded methods (or constructors):
CLASS Widening:
/* 1 */ METHOD PUBLIC VOID setVal (INPUT piVal AS INTEGER):
END METHOD.
/* 2 */ METHOD PUBLIC VOID setVal (INPUT pdVal AS DECIMAL):
END METHOD.
END CLASS.
When the following procedure calls the setVal( ) method with a given parameter, the overloaded method definition that it matches corresponds to the bold-faced number referenced in the comments:
DEFINE VARIABLE rWid AS CLASS Widening NO-UNDO.
DEFINE VARIABLE iVal AS INTEGER INITIAL 42 NO-UNDO.
DEFINE VARIABLE i64Val AS INT64 INITIAL 42 NO-UNDO.
DEFINE VARIABLE dVal AS DECIMAL INITIAL 4.2 NO-UNDO.