Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Not overload method then wat?
Message
De
03/11/2002 15:10:34
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
02/11/2002 23:12:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00718248
Message ID:
00718329
Vues:
20
>Hi,
>I have a function that need to have overload feature. Since VFP doesn;t support overload, how could I implement it?
>
>Print(cText, cAlighment)
>Print(cText1, cText2, ....)

AFAIK, the main reason for introducing the overload was to allow the same operation or function to work on different types of operands. Now since VFP doesn't have to use strict typing, you can pass any type of operand as a parameter to a function (or procedure or method), and it will be passed as is, without prior checking. VFP's internal functions check the type of parameters only after they are passed.

So, in a way, we can say VFP already has the overload in functions, procedures, methods (but not in operations).

Now dealing with the unknown type of parameter is the matter of startup code in your function - the usual set of functions like empty(), pcount(), type(), vartype(), isalpha(), isdigit() and such can be used to decide what sort of, and how many parameters were passed.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform