Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Different between private and local
Message
From
01/11/2000 04:57:45
Liam O'Hagan
O'Hagan Programming Ltd
Ireland
 
 
To
01/11/2000 02:23:05
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00436575
Message ID:
00436593
Views:
17
Hi Jasper,

A LOCAL variable is one that is defined within a procedure or function for use within that procedure or function. It is scoped to that procedure or function alone and cannot be accessed by calling or called procedures or functions. The variable is destroyed when the program that declared it terminates.

There is no such thing as a PRIVATE variable. The PRIVATE keyword hides specified variables that were created in a higher level program
from the current procedure or function. This would be used if you had (for example) wished to declare a variable that had the same name as a public variable.

Another type of variable is one that is declared but not specifically scoped with LOCAL or PUBLIC. If you declare a variable by assigning it a value, eg cNewVar = "Some Value", that variable is scoped to the procedure or function that declared it and any called procedures or functions. The variable is destroyed when the program that declared it terminates.


HTH

Liam

> Hello all,
> I have a interest to know what is the different between 'PRIVATE' AND 'LOCAL' variable. I use VFP6, I always use LOCAL in my program and it seems working fine. But I like to know when I can use PRIVATE will be better?
> I have read the VFP online help many time about these two keyword, but I am too stupid to know the different.
> Thanks for all.
>-Jasper^_^
Liam O'Hagan
MCP VFP Desktop Apps
Previous
Reply
Map
View

Click here to load this message in the networking platform