Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
NewObject() vs AddObject()
Message
From
13/02/2008 11:59:06
 
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
01292009
Message ID:
01292229
Views:
36
Yes, as I said, the difference is that AddObject works with the loaded classes in memory, while NewObject allows to specify the class explicitly. In the later case the NewObject is supposed to be quicker (I would think) but in reality I'm not sure, I vagually recall some discussion about the opposite effect.

From the VFP help file on NEWOBJECT():

For NEWOBJECT( ), Visual FoxPro performs an internal SET CLASSLIB or SET PROCEDURE for the second or third parameters using the ADDITIVE clause where the parameters are first used to determine the search order. If these parameters already exist in the SET CLASSLIB or SET PROCEDURE list, Visual FoxPro rearranges the order in the list so they come first. Visual FoxPro then locates all the classes, creates the object, and calls the Init events. Finally, Visual FoxPro restores the original SET CLASSLIB or SET PROCEDURE list if the installation did not change list.

This would imply that NEWOBJECT() is slower...
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform