0

pleaasseee give me ideas for "composition" that has a relation "has a/an"

19th Oct 2017, 11:08 PM
Noush Rabah
Noush Rabah - avatar
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.
20th Oct 2017, 12:36 AM
Tamra
Tamra - avatar
+ 1
here is another example books and library . the library composed of books so if there isn't books there isn't library .
20th Oct 2017, 2:19 AM
amr hassan (3Mo0or)
amr hassan (3Mo0or) - avatar