Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
NewObject or CreateObject or AddObject
Message
De
29/08/2007 01:16:46
 
 
À
28/08/2007 10:23:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01250745
Message ID:
01251073
Vues:
16
>This has one very significant benefit for us as developers. Since there is a parent-child relationship Visual FoxPro can manage the garbage collection for us. By definition, an object which is contained, and owned, by another shares the scope of its parent. So when you destroy a composite object, all of the components are released also (Forms could not work if this were not the case!). This is not the case when you use aggregation, you must be especially careful to clean up any outstanding object references because VFP cannot resolve them for you.

About the only case where aggregation is preferred on controls able to function as a container is whenever you want to exchange the object depending on the task at hand. Some OOPurists argue to release the whole parent object and build a new one. I think loading a different object into the same property is better, even if you have to be careful of manual disposal.

regards

thomas
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform