Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Strong typing in visual foxpro
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP1
Database:
Visual FoxPro
Divers
Thread ID:
01049322
Message ID:
01049383
Vues:
15
>> Is there any way to accomplish strong typed programming
>> in visual foxpro class that are created with visual foxpro
>> class creation tool. For example how can i say a class method
>> returns an integer value with "as integer"?
>
>No, VFP is a "late binding" language. Strong typing can not be accomplished. The only thing You can do is use naming conventions and discipline. You can initialize a numeric return-Value that will be altered when the method runs trough properly, and if not, the initial Value is returned.
>
>The following will surely cause problems
>
>
>procedure ValidFile(tcFile as string) as integer
>
>if vartype(tcFile) # "C"
>   return
>endif
>
>return iif( file(tcFile), 1, 0)
>endproc
>
>
>as You might get a type logical *or* nurmeric
>
>however this will work
>
>
>procedure ValidFile(tcFile as string) as integer
>
>local lnRetVal
>lnRetVal = -1
>
>if vartype(tcFile) # "C"
>   return lnRetVal
>endif
>
>lnRetVal =  iif( file(tcFile), 1, 0)
>return lnRetVal
>endproc
>
How about using only one return statement in the function/procedure? I know, it's could be very difficult...
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform