Composition
1. Compostion is 'Part of' Relation.
2. The life time of the object managed by main class. If main class
destroyed composited object also destroyed.
3. In UML diagram composition shows with filled diagram.
in below example if Car object destroyed Engine object also destroyed.
Aggregation
Agregation gives 'has a' relationship. Even if main objecte destroyed aggregated object does not destroyed.
If you take Customer class and Address Class. We can say that customer has address we dont say Address is part of the customer. Aggregation show in UML diagram with unfilled diamond.
1. Compostion is 'Part of' Relation.
2. The life time of the object managed by main class. If main class
destroyed composited object also destroyed.
3. In UML diagram composition shows with filled diagram.
in below example if Car object destroyed Engine object also destroyed.
Aggregation
Agregation gives 'has a' relationship. Even if main objecte destroyed aggregated object does not destroyed.
If you take Customer class and Address Class. We can say that customer has address we dont say Address is part of the customer. Aggregation show in UML diagram with unfilled diamond.
No comments:
Post a Comment