General information
Category:
Object Oriented Programming
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only