Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Local vs private
Message
De
09/08/2005 19:48:56
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01039725
Message ID:
01039729
Vues:
21
Thanks Sergy, that explains a 3 hour puzzle I worked on this AM. But if the PRIVATE variables can be seen by the chain of functions and procedures that follow and initial routine, how does that differ from PUBLIC? Is it that the PUBLIC variable can be seen even if it wasn't identified in the calling program?


>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform