Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Strong typing in visual foxpro
Message
 
À
14/09/2005 04:18:08
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:
01049324
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
Regards from Berlin

Frank

Dietrich Datentechnik (Berlin)
Softwarekombinat Teltow (Teltow)

Frank.Dietrich@dd-tech.de
DFPUG # 327
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform