using openedge 10.2.b
ItemObj.cls
CLASS mystuff.ItemObj :
METHOD PUBLIC CHARACTER GetItemDesc
( INPUT pcOne AS CHARACTER,
INPUT pcTwo AS CHARACTER,
INPUT piThree AS INTEGER ) :
RETURN pcOne pcTwo pcThree.
END METHOD.
ItemObj.p
USING mystuff.*.
DEFINE VARIABLE rItemObj AS CLASS mystuff.ItemObj NO-UNDO.
rItemObj = NEW mystuff.ItemObj( ).
MESSAGE "One : " rItemObj:GetItemDesc (1) SKIP(1)
"Two : " rItemObj:GetItemDesc (1, 2) SKIP(1)
"Three : " rItemObj:GetItemDesc (1, 2, 3) VIEW-AS ALERT-BOX INFO.
DELETE OBJECT rItemObj.
I want the output of all these statements to be the same so that if a user enters only 1 input the other two default to 2 and 3 and the same if the user enter 1 and 2, three is defaulted to 3.
How do I do this without getting a mismatch parameters error?
IIRC Progress doesn’t allow optional parameters in method definitions, so you’d have to create a method definition for each argument permutation or accept a data structure that handles multiple values as a parameter like a dynamic array, temp-table or custom object and unpack that (but then you’re pushing logic onto your caller).