Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A basic thought about LOCAL variables
Message
 
To
28/12/1999 13:55:34
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00309158
Message ID:
00309547
Views:
30
>... and that PUBLICs can be seen by any routine. By outlive, do you mean, can be seen by outside routines, or does not die the same time the routine does? To me they are not the same thing.

Mike,

Publics outlive the routine that creates them. Privates can be seen outside the routine that creates them but only if that routine is still inthe calling stack. The difference between public and private variables is that publics outliove the creating routine.

>... and that PUBLIC creates the variable, PRIVATE does not.

Don't confuse the two declaration commands with the scope of the variables. Public, private, and local are scopes for variables and they are also VFP keywords used to declare the scope for variables.

PUBLIC creates the variable and assigns it a value of .F. as does LOCAL. PRIVATE, on the other hand, simply hides any variables that have the name being declared.

And ... All variables created without explicitly declaring their scope are private in scope.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform