Aggregation and Composition in java

Total Post:149

 1222  View(s)
Rate this:
can any one explain the aggregation and composition with the low level example that i can understand easily example should be programming example
  1. Post:159

    Re: Aggregation and Composition in java

    Composition means that the object doesn't make sense without the composed part.

    Aggregation means the aggregated part can exist independently from the object. 

    Example:  a car doesn't make much sense without an axle and vice versa. So a car is composed of an axle. But the CD player in the car can exists independently from the car (in some cases). So the car and the CD player are aggregated.

  1. Post:397

    Re: Aggregation and Composition in java

    For car example:

    Composition: Car and wheel. 
    Aggregation: Car and passenger.

    This diagram will make the difference more clear among the relationships:


Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.