Information générale
Catégorie:
Programmation Orientée Object
Versions des environnements
>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
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