Life expectancy depends on ownership, but ownership is a key idea in distinguishing between aggregation and composition. As part of the dependent object, it belongs entirely to the container. The implication for this in C ++ is that the container must take care of its destruction in order to avoid memory leak. In C #, it depends on the type of object / memory (managed or unmanaged); the container must implement IDisposable and clear unmanaged, compositional objects. In both cases, the aggregates exist independently of the container and cannot be cleaned after.
source share