Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Public and local variable of the same name?
Message
 
 
À
16/01/2008 17:41:46
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01282432
Message ID:
01282445
Vues:
19
Thank you, Hilmar. This is what I intend to do, have a different variable name for public and local. Hopefully the naming is not scattered in two many functions and changing will not be a huge task.

>I don't think so, since a local or public variable should hide a variable with the same name, coming from a higher level.
>
>However, the recommended naming practice would avoid this situation entirely:
>
>
>public goMyApp
>goMyApp = createobj("MYAPPCLASS")
>
>function MyFunct
>local loMyApp
>loMyApp = createobj("MYAPPCLASS")
>return
>
>
>Note that the first letter indicates the scope - g for "global" (public, can't use "p" since it is the same letter as private), l for "local". The second letter indicates the type of the variable, here, "o" for object.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform