SOFTWARE DESIGN
OBJECT ORIENTED DESIGN
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
Car and seat covers
|
|
car and music system
|
|
car and colour
|
|
car and engine
|
Detailed explanation-1: -Composition is a way to wrap simple objects or data types into a single unit. Aggregation differs from ordinary composition in that it does not imply ownership. In composition, parent entity owns child entity. In Aggregation, parent Has-A relationship with child entity.
Detailed explanation-2: -For example, A ‘Human’ class is a composition of Heart and lungs. When the human object dies, nobody parts exist. The composition is a restricted form of Aggregation. In Composition, one class includes another class and is dependent on it so that it cannot functionally exist without another class.
Detailed explanation-3: -There are two types of composition: association and aggregation. Both types of composition include a has-a relationship. However, there are differences between associations and aggregations based on how you visualize the composed objects of the whole object.