Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best approach about #DEFINE constants
Message
From
15/05/2008 11:06:29
 
 
To
15/05/2008 10:57:32
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01316940
Message ID:
01317313
Views:
12
>>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform