0
pleaasseee give me ideas for "composition" that has a relation "has a/an"
2 Answers
+ 9
Composition is where an object is composed/made of other objects. Here's an example:
Let's say you made a program that simulated a board game. You'd likely have a Game class, that controls everything, like whose turn it is, or whether the game is over or not.
What does this game have? It probably "has a" Board, which keeps track of the game's status, and "has" two or more Players, who have their own scores and stats. So the class Game is composed of Board and Player objects.
A Board class may also "have" Pieces or Cards objects.
+ 1
here is another example books and library . the library composed of books so if there isn't books there isn't library .