I am trying to model Team and Players relationship in terms of writable code following OOP.
Let's say I have a class Team
and Player
For representing the relationship between both, which option is better & why?
What are the pros & cons of each?
Option A
class Team {
// inside team class
List<Player> players;
}
Option B
//separate class
class TeamPlayers {
Team team;
List<Player> players;
}
Aucun commentaire:
Enregistrer un commentaire