Click here to Skip to main content
15,886,083 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
What type of relation between classes would you use for creating a bowling game,particulary in Field - Ball - Ninepin classes? Aggregation or Composition?

What I have tried:

I'm planning on using Aggregation,because the Ball and Ninepins still exists without Field,but they just have no use without Field,so I'm not sure what to do...
Posted
Updated 4-Feb-20 14:04pm

1 solution

The Field could also exist without the Ball and Pins. But there's probably a Game that ties them all together. I wouldn't worry about which model is correct, and it's hard to answer your question without knowing what you actually have to code. One extreme would be simply coding the rules for scoring, and the other extreme would be modelling how the ball strikes the pins, their resulting trajectories, which ones get knocked over...
 
Share this answer
 
v2
Comments
Maciej Los 5-Feb-20 2:04am    
5ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900