Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning a value from a class form
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00579966
Message ID:
00581672
Views:
51
>>>It is very easy to totally eliminate this potential problem forever, simply NEVER USE PUBLIC VARIABLES and this problem will NEVER happen.
>>
>>Would the problem still exist if the public variables were RELEASEd properly? Creating a public variable and not releasing it sounds like more of a bad programming practive than using a public variable.
>
>Mike,
>
>Here's my point;
>
>Create a public var (you must release it or else trouble may occur)
>
>Create a privbate var (it gets released when the routine ends and is global to everything called)
>
>So, then, I ask why ever use a public as it only introduces a possible omission for you (forget to release it). A private in the start up program has all of the "benefits" of public and yet it does not have the one MAJOR drawback of outliving its creator.

Jim;

Are you inferring a programmer might forget about clearing a line of code? :) Now I will not be able to sleep at night! I do know some guys that “walk on water” and would never forget anything! As for me I would rather not use public as it will bite you.

I was given the code of another VFP programmer to clean up and make it work. He used 53 public variables – in places like the Init and UIenable of objects. Never did he use more than one public declaration in one place. There were 20 forms and this was a critical project for our company. He even changed data types on the fly – numeric to character, etc. I am glad he did not write code to clear any of these public variables, as that would have been another pain where I sit down. :)

Tom
Previous
Reply
Map
View

Click here to load this message in the networking platform