Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Public or Private
Message
From
30/09/1997 00:57:09
 
 
To
29/09/1997 23:19:32
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00052342
Message ID:
00052351
Views:
42
>I have been told that any variable in a program (*.prg file) is
>private unless declared as public. Is this true? Variables I make

Yes and no. If the variable doesn't exist at previous calling level, the variable is private by default. If the variable exists at previous level, this variable is used, so, it's not private at the level you are.

The "private" status depends on the level the variable is defined/used. Ie, a variable may be private at the level where is defined or used for the first time, but is not private at any level that is called from the current level.

It's a very good practice to define all variables that you want private with an explicit PRIVATE definition, preferably at the begining of the function/procedure.

This insures you that the variables are private where you want them to be private and offers a place where you can see all used variables in a procedure.

Vlad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform