Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Strong typing in visual foxpro
Message
De
14/09/2005 09:44:52
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
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:
01049397
Vues:
13
>>> 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...

My preference is like Frank's. Multiple returns is good:)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform