Thursday, April 9, 2009

OOP Assignment Solution

Association is a relationship where all object have their own lifecycle and there is no owner. Let’s take an example of Teacher and Student. Multiple students can associate with single teacher and single student can associate with multiple teachers but there is no ownership between the objects and both have their own lifecycle
Aggregation : It indicates a “whole/part” relationship.
For example a department of the faculty has instructors.
Parts ( instructors ) can still exist even if the whole ( the department ) does not exist.

Composition : Composition is a strong kind of aggregation where the parts cannot exist independently of the “whole” object.
For example “ A human has head ”

Here head cannot be as a single part. Hence it is said to be a composition.
The relations among them are given as,


1 comment:

  1. Please dont mind your assignment is incorrect.

    ReplyDelete