Answer the question
In order to leave comments, you need to log in
How is aggregation different from composition?
I know that the word aggregation is well known to people writing in c# and I assume that they are familiar with typescript. Therefore, if it doesn’t make it difficult, explain with the example of typescript what aggregation is and show how it differs from composition.
Answer the question
In order to leave comments, you need to log in
It doesn't matter in which language to compare aggregation and composition. The two concepts are has-a relationships, that is, they are technically implemented in the same way: for example, a class or a separate instance of a class (if the prototype of an object does not have such a property) refers using fields to instances of another class (although not necessarily another). The difference is that in the case of composition, one class is more dependent on another explicitly defined class and, by and large, cannot exist without it.
Here are a couple of links:
* sergeyteplyakov.blogspot.com/2012/12/vs-vs.html
* programmers.stackexchange.com/questions/61376/aggr...
Also note that in the case of composition, the class/object itself determines the links and the lifetime of those links -- that is, it owns it entirely.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question