Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Private vars
Message
 
 
À
01/06/2001 09:38:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00513736
Message ID:
00513749
Vues:
15
This message has been marked as a message which has helped to the initial question of the thread.
>reading a recent post, I read ( then proved ) that if you declear a private var in you main program it will have golbal scope.
>
>WHY!!!?!?!?!
>
>unless I'm mistaken, in most ( if not all ) other programming languages when you declair a private var it is scoped to that file, method, function, etc. I should be able to declair the Var isSomeThing as private anywhere in the program, and anywhere else ( other than that function, etc. ) isSomeThing should not exist, irregardless of how it came to that piece of code ( even if it is in the main.prg file ).
>
>I don't understand why the deviation on something so primitive.
>
>- jer

SET OPINION ON
To maintain backward compatibility, VFP added the LOCAL keyword for this type of variable. In the FPD/FPW days, we didn't have variables scoped to procedures/methods. As George said, PRIVATE in those days menat visible from this point on in the call stack. In order not to break this and to add a needed concept, LOCAL was born.
SET OPINION OFF
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform