Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Public or Private
Message
De
30/09/1997 00:57:09
 
 
À
29/09/1997 23:19:32
Andy Roth
Neyenesch Printers
Californie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00052342
Message ID:
00052351
Vues:
47
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform