mercredi 8 avril 2020

Is this family class diagram and example of aggregation or composition?

I'm looking for a some clarification I have with regards to the class diagram below: "Is it an aggregation or a composition? Explain why."

Class Diagram in question

I'm in two minds about this answer. From what I understand initially the student 'has a' family, mother and father; therefore this is an example of composition because the concept of a mother or father cease to exist without the student (son,daughter) existing. However, if I look at it another way, if the student (child) [ceases to exist]/[never existed at all], there is still the possibility that two individual objects (here named Father and Mother) exist and would still contain the same attributes; which would be an example of aggregation.

Hopefully how I've tried to convey my line of thought makes sense. Can somebody please clear this up for me?

Thank you for your time.

Aucun commentaire:

Enregistrer un commentaire