Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How does VFP load class methods into memory?
Message
 
 
To
16/11/2009 09:31:05
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01434853
Message ID:
01435150
Views:
87
The (2) is only partially correct. The properties are initialized only once when class definition is loaded in the memory first time. After that VFP creates new instances using cached class definition property values.
oObj11 = CREATEOBJECT("Test1")
? oObj11.tDt, oObj11.tDt

INKEY(1)

oObj = CREATEOBJECT("Test")
? oObj.tDt		&& The same as in prefious object

INKEY(1)

oObj12 = CREATEOBJECT("Test1")
? oObj11.tDt, oObj11.tDt	&& The same as in the first object

DEFINE CLASS Test1 AS TEST
	tDt2 = DATETIME()
ENDDEFINE

DEFINE CLASS Test AS Session
	tDt = DATETIME()
ENDDEFINE
>
>It goes without saying that (1) only the class definition is kept in memory (2) the object properties are not shared. Properties have to be initialized each time
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform