Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Variable Scoping
Message
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00861687
Message ID:
00861695
Views:
17
As far as I know, public vars exist until either you explicitly release them or the VFP session terminates.

If you are inside a method or procedure and declare a local var with the same name as the global var, the local instance of the var "hides" the global instance until the local one is explicitly released or goes out of scope.

The only global vars that I use are object references. If I need some values available globally, I add a property to the appropriate global object and store it there. For instance, I have a global user object that stores the login ID and MAC of the current user for reference through out the entire application. If I find I need to store the security level of the current user, I would add that as a property to my global user object (well, to the class).

I have yet to find a con to using global objects to store "global" values. You may want to experiment with it to see if it is right for you.

Jason
---------
Single field, surrogate primary keys....because it's sexier!

Third normal form is more than just a good idea.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform