Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Local vs private
Message
 
 
À
09/08/2005 19:17:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01039725
Message ID:
01039727
Vues:
19
The private variables/parameters are visible in the called programs. The LOCAL variables/parameters are only visible in the program where they have been declared.
PRIVATE pcVar1
LOCAL lcVvar2

pcVar1 = "PRIVATE"
lcVvar2 = "LOCAL"
? pcVar1
? lcVvar2

DO myprg

PROCEDURE myprg
? pcVar1
? lcVvar2    && Error
RETURN
Also, as you correctly noted, LOCAL defines variable. The PRIVATE only hides variable if it existed before or does nothing if variable didn't exist. Any variable that get value assigned w/o declaration became PRIVATE in scope.


>Can someone give me a simple but clear understanding of the difference between LOCAL and PRIVATE? I've read the docs but they leave me unsatisfied. I understand that LOCAL actually creates a variable whereas PRIVATE does not. So is PRIVATE just a means to convert a public variable into a local one?
>
>Also LPARAMETERS vs PARAMETERS? One is LOCAL and the other is PRIVATE? I don't see the difference. Also, aren't variables created as LOCAL or PRIVATE by default without specifying? If so, what's the point?
>
>Thanks for any insights in this.
>
>- Don
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform