I played with that idea last night and found that what you just
confirmed for me is true. I will continue to declare all my variables
as private just in case I happen to use the same name as a public
variable.
Thanks for you reply.
Andy
>
>>I have been told that any variable in a program (*.prg file) is
>>private unless declared as public. Is this true? Variables I make
>
>Yes and no. If the variable doesn't exist at previous calling level, the
>variable is private by default. If the variable exists at previous level,
>this variable is used, so, it's not private at the level you are.
>
>The "private" status depends on the level the variable is defined/used. Ie,
>a variable may be private at the level where is defined or used for the
>first time, but is not private at any level that is called from the current
>level.
>
>It's a very good practice to define all variables that you want private
>with an explicit PRIVATE definition, preferably at the begining of the
>function/procedure.
>
>This insures you that the variables are private where you want them to be
>private and offers a place where you can see all used variables in a
>procedure.
>
>Vlad
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only