General information
Category:
Object Oriented Programming
>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
Previous
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