OOPS Design concepts - difference between association and aggregation

Total Post:104

C#  Java  OOPS 
 1054  View(s)
Rate this:
I am pretty confused about oops design principles. In UML class diagram there are notations of association and aggregation. I want to undersatnd what is the exact difference between these two, because according to me these are very similar and used for same purpose    
  1. Post:397

    Re: OOPS Design concepts - difference between association and aggregation

    Association is a relationship between two objects. In other words, association defines the multiplicity between objects. You may be aware of one-to-one, one-to-many, many-to-one, many-to-many all these words define an association between objects. Aggregation is a special form of association. Composition is a special form of aggregation. 

    ExampleA Student and a Faculty are having an association.

    Aggregation is a special case of association. A directional association between objects. When an object ‘has-a’ another object, then you have got an aggregation between them. Direction between them specified which object contains the other object. Aggregation is also called a “Has-a” relationship
    Example : (City, Tree, Car) "sub objects" (Tree, Car) will NOT be destroyed when City is destroyed.

      Modified On Apr-10-2018 04:34:42 AM