Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Public variables
Message
 
À
13/06/2002 14:32:18
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00667392
Message ID:
00668175
Vues:
25
>Jim,
>
>>This si a violation of the basic programming principle of encapsulation, that is any routing should have everything it needs within it self or receive those things as parameters.
>
>Ok. What to say about that suggested by other fellows in creating a global object and setting its properties, to play the role of public vars?

Fernando,

Youn are making the common error of thinking that PUBLIC vars are the same thing as Global vars, they are not the same. Global var can bee seen and manipulated anywhere within the system, a public var outlives the routine that creates it. These are NOT the same thing. A private variable declared in the top level of a system is Global to that system.

Using an object to hold the global values is an OOP way of doing the same thing. The ref to the global object does NOT need to be a pubic var though. A private var created in the start up program for the system will accomplish the creation of a global var holding the ref to the object.

The issue folks are cautioning you about is NOT global vars, it is VFP Public vars.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform