>Overloaded method are not so bad. For one thing, it can lead to more elegant code because you can have different code for a different list of parameters. And thus, you don't have to write lines like this :
I didn't say that so bad. Only I said I don't needed in in VFP. Usually overloaded methods do some in most situations, so at worst in VFP you have to write a case or if in first lines like in your sample.
>
>FUNCTION Test(Param1, Param2)
>DO CASE
>CASE PCOUNT() == 1
> ** do this
>CASE PCOUNT() == 2
> ** do that
>ENDCASE
>
>
>with overloaded methods, you can write :
>
>FUNCTION Test(Param1)
> ** do this
>ENDFUNC
>
>FUNCTION Test(Param1, Param2)
> ** do that
>ENDFUNC
>
>
What is the different? I can't see. But in vfp I can do that:
FUNCTION Test(Param1, Param2)
if PCOUNT()== 2
param2=iif(type("param1")="C","",0)
endif
return param1+param2
Look at that. Code lines fewer from a overloaded method.