Design the Team creation contract around what the caller knows and what Team should initialize itself. A constructor is more useful when its parameters have clear responsibilities.
| Information | Choice | Reason |
|---|---|---|
| Team name | Caller supplies string | Different teams have different names |
| Captain | Caller supplies Player reference | The player already exists |
| Roster list | Team creates internally | Team owns its roster storage |
| Initial captain entry | Team registers internally | Avoid a separate setup step |
This continues the received-reference and contained-object examples.
A suitable signature is public Team(string name, Player captain). The body assigns the supplied name and captain, creates its list, and registers the captain. State that the supplied captain must be non-null, unless the design explicitly handles that case.
A long parameter list can be difficult to read. Begin with small contracts and use named local variables for supplied objects. Do not introduce extra classes or advanced syntax just to shorten a beginner example.