Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Public variables
Message
De
12/12/1998 12:15:10
 
 
À
12/12/1998 09:57:48
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00166872
Message ID:
00166888
Vues:
21
>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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform