Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
NewObject() vs AddObject()
Message
 
 
To
13/02/2008 11:59:06
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
01292009
Message ID:
01292234
Views:
31
>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...

Good to know. I guess that's where my recollections came from - from reading VFP Help some day in the past.

I don't have it on the computers connected to Internet anymore and I didn't try to check online.

Thanks for the explanation.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform