Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Error : Illegal redefinition of variable
Message
De
25/07/2013 09:31:26
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01579124
Message ID:
01579200
Vues:
52
>>>That does not mean use every tool. Name one time where public is the most desirable.
>>goApp.
>
>I wonder if that is necessary to declare goApp as PUBLIC. Private would work as well, when
>goApp is instantiated in the main.prg before READ EVENTS, at least that's what I'm doing now.


It has the same effect as being PUBLIC when created from the top level program. Many designs do not put goApp creation in MAIN.PRG, but in a called class or procedure.


A couple other reasons to use PUBLIC variables are:
(1) To prevent the requirement of passing "constant" parameters (that don't change during the course of the repeatedly called function (as in recursion), but are dynamic based on the startup / runtime environment when called)

(2) To prevent the need for initializing variables within a oft / repeatedly called function

Visual FreePro bypasses #2 by a new LOCAL PERSIST keyword, which retains the prior value on subsequent function calls by that thread.
See: http://www.visual-freepro.org/wiki/index.php/VXB%2B%2B#LOCAL_PERSIST_Variables
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform