Information générale
Catégorie:
Programmation Orientée Object
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...
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement