Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Public and local variable of the same name?
Message
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01282432
Message ID:
01282507
Views:
11
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?
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform