Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best approach about #DEFINE constants
Message
De
15/05/2008 11:06:29
 
 
À
15/05/2008 10:57:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01316940
Message ID:
01317313
Vues:
13
>>>Yes - Public and default variables (AKA Private) would be visible, as opposed to Local vars.
>>>
>>>
>>>hth
>>
>>You did test it with the form, correct? In various form's methods?
>
>Keep in mind that PRIVATE does ***NOT*** 'create' any variable.
>So if you want such "variables" available with some value in later methods/functions/etc you have to both declare them PRIVATE and assign values to each right away.

I would put it that way:
Private is not a declaration, as opposed to Public and Local.
An undeclared variable is available as long as the method/procedure where it was created is in the calling stack. (IOW, in a procedure and all subprocedures called from there.
In case of a project's "main.prg" that means it is available as long as the app is running (unless being explicitly Released)).

The Private keyword is only required when you want to protect an existing undeclared variable when you create a new one with the same name in a sub-procedure.
So "Private" is not a declaration but a kind of umbrella.


-Stefan
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform