Presentation is loading. Please wait.

Presentation is loading. Please wait.

Association / Aggregation / Composition and inheritance

Similar presentations


Presentation on theme: "Association / Aggregation / Composition and inheritance"— Presentation transcript:

1 Association / Aggregation / Composition and inheritance

2 Association Relationship where all object have their own lifecycle and there is no owner. Ex: Airplane and passengers. No ownership between the objects and both have their own lifecycle. Both can create and delete independently

3 Aggregation Special form of Association where all object have their own lifecycle but there is ownership ( Has a relationship) and child object can not belongs to another parent object. Ex: Department and teacher. A single teacher can not belongs to multiple departments, but if we delete the department teacher object will not destroy.

4 Composition Special form of Aggregation . Child object dose not have their lifecycle and if parent object deletes, all child object will also be deleted (ownership). Ex : Person and hands.

5

6 Inheritance : ”is” relationship
An employee is a person

7 Association No ownership Own lifecycle Aggregation Ownership ( has a..) Composition Ownership (composed of ..) No Own lifecycle Inheritance Is relationship

8 Association An association is usually represented as a data field in the class.

9 Representing Aggregation/composition in Classes
An aggregation / composition relationship is usually represented as a data field in the aggregated class.

10 Inheritance Inheritance models the is-an-extension-of relationship between two classes.

11 Borrowing Loans Name Loan Person Borrower Address


Download ppt "Association / Aggregation / Composition and inheritance"

Similar presentations


Ads by Google