Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Public and local variable of the same name?
Message
De
17/01/2008 09:14:37
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01282432
Message ID:
01282537
Vues:
9
A property of _screen will not be cleared or released without being called explicitely.

>I see. But will it fundamentally change anything, to have a public variable vs. a property of _screen? Thank you for your suggestion.
>
>>If you add this variable to _screen, you can still use it everywhere.
>>
>>>Thank you, Tore.
>>>
>>>In this case, I have not choice but to use a public variable. I am using it to load DBCXMgr manager ('DBCXMGR.VCX') which is part of stonefield SDT. This object is used throughout the application by stonefield query.
>>>
>>>>No, there should be no conflicts. But still you should try to avoid using public variables. And the ""normal" way to declare variables is to let the first letter describe the scope, and the second is the variable type. A few examples:
>>>>
>>>>lcMystring means a local variable of type character
>>>>pnValue is a private numeric variable
>>>>glLogical is a public (g=global) logical variable.
>>>>
>>>>
>>>>>Is it a problem if a public and a local variable have the same name and are created from the same class?
>>>>>
>>>>>For example, say I have a public variable oMyApp that is instantiated from class MYAPPCLASS. Then in some functions I have a local variable oMyApp created by instantiating the same class? E.g, very simplified:
>>>>>
>>>>>
>>>>>public oMyApp
>>>>>oMyApp = createobj("MYAPPCLASS")
>>>>>
>>>>>
>>>>>
>>>>>function MyFunct
>>>>>local oMyApp
>>>>>oMyApp = createobj("MYAPPCLASS")
>>>>>return
>>>>>
>>>>>
>>>>>Can there be any conflicts?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform