Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best approach about #DEFINE constants
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01316940
Message ID:
01317654
Views:
8
>>Not at all. I said leaving the properties on such a public object public is no better than public variables.
>
>In other words, in order to use constants in the application you would have to do something like
>
>oGlobal.GetPI()
>...
>
>Sounds inconvenient to me.
_Screen.AddProperty('GlobalConstants', Createobject('GlobalConstants'))

PI = _Screen.GlobalConstants.PI

? _Screen.GlobalConstants.PI
_Screen.GlobalConstants.PI		= 5
? _Screen.GlobalConstants.PI


define class GlobalConstants as Session
	PI = Pi()
	
	function PI_Assign(txNewValue)
		error 'PI is a Constant'
	endfunc
enddefine
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Reply
Map
View

Click here to load this message in the networking platform