I have seen many class diagrams on popular websites and design courses defining the relationships using composition like: Admin has a person instance Umpire has a person instance
As per me, shouldn't it be the case of inheritance as admin 'is-a' person, umpire 'is-a' person. Admin extends Person Umpire extends Person
Can you please help me understand why we are preferring composition here?
Aucun commentaire:
Enregistrer un commentaire