Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Public and local variable of the same name?
Message
 
 
To
18/01/2008 06:26:32
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01282432
Message ID:
01283048
Views:
18
Hi Hilmar,

Good point about local variable "blocking" the public variable. I have already changed the local variable name to loMeta and therefore should be no conflict. Thank you very much for your help.

>I was forgetting the following:
>
>If a public and a local/private variables do have the same name, then, as far as I know, you won't be able to access the public variable. This may defeat the purpose of having a public variable in the first place, although there is of course a chance that you actually don't need it in a specific procedure.
>
>So, once again, I would simply avoid this situation, by giving the local variable a name that starts with "l" for "local". (The public variable should start with "g" for "global", but may be more difficult to change if you already use it in scores of places.)
>
>>Is it a problem if a public and a local variable have the same name and are created from the same class?
>> ...
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform