Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
NewObject() vs AddObject()
Message
De
13/02/2008 11:59:06
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
01292009
Message ID:
01292229
Vues:
37
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
Fil
Voir

Click here to load this message in the networking platform