Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Public variables
Message
From
12/12/1998 12:15:10
 
 
To
12/12/1998 09:57:48
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00166872
Message ID:
00166888
Views:
18
>I have read in several messages, including some in reponse to my own inquiries, that use of public variables is not good practice. If so, what are the primary reasons?

Public variables can be changed by any called subroutine. This is not an OOP issue because the the ramifications of this affect procedural code as well as objects. If you use a public variable and you call a subroutine that uses and automatically scoped variable (not declared local, local, private, or public), any values the subroutine assigns to "its" variable will change the value of the global (public) variable. This can cause all sort of unexpected and hard to find side effects.
Previous
Reply
Map
View

Click here to load this message in the networking platform