Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Not overload method then wat?
Message
From
03/11/2002 15:10:34
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
02/11/2002 23:12:23
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00718248
Message ID:
00718329
Views:
19
>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform