I am studying design patterns. In the UML description aggregation its defined so : A has B , and B can outlive A. Element to describe that is :
A<>------B (where the funny arrows, should be a diamond)
I simply do not understand the concept of "OUTLIVE" even if I understand that B type is in A under the form of a field (property...etc).
What do they mean with this "outlive" ?? In which case B can outlive A ?
It means that B is/could be referenced from outside A in some way.
It's easier to get in contrast with Composition, where B is solely 'owned' by A and then when A becomes unreachable, B automatically becomes garbage too.
So lifetime is used here to define visibility/scope. A little backward reasoning.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With