>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^_^
Jasper,
Actually don't bother and continue to use local. Historically local was introduced to Foxpro after private. There are slight differences like one creates vars while other doesn't, local narrowes the scope to procedure while private ones could be seen by lower level procedures etc. but practically local would work nicely IMHO. Here is a very simple sample :
m.Test1 = 1
? 'Before func calls', m.test1
=Func1()
? 'After func calls', m.test1
function func1
private all
on error wait window 'Var not defined yet'
? 'Func1 before assignment', m.test1
on error
m.test1 = 5
? 'Func1', m.test1
=func2()
? 'Func1 after Func2 call', m.test1
function func2
local m.test1
? 'Func2', m.test1
=func3()
? 'Func2 after Func3 call', m.test1
function func3
? 'Func3 before value change', m.test1
m.Test1 = m.test1^2
? 'Func3 after value change', m.test1
Cetin