Association vs. Aggregation vs. Composition in Java

前端 未结 3 1328
深忆病人
深忆病人 2020-12-14 13:02

I\'m trying to understand what these terms mean. And I came with few examples like:

Aggregation : Facebook has a user

Composition : Each us

3条回答
  •  悲哀的现实
    2020-12-14 13:44

    The uses a relationship means two things

    ->both can exist independently

    ->Data flows from the whole classifier(people) to the part classifier(browser)

    The has a relationship means two things

    ->the lifetime of the part classifier(session) is dependent on the lifetime of the whole classifier(facebook)

    ->data usually flows in only one direction (that is, from the whole classifier(facebook) to the part classifier(session)).

提交回复
热议问题