-1

What is it like Aggregation and Association in Code?(Java or C#)
I can't find the code examples of Aggregation and Association.

1 Answers1

1

Association example: Employee has Address

public class Employee  
{         
   public Address address; //Employee HAS-A Address  
}

Aggregation example: Employee has many Address

public class Employee  
{         
  public List<Address> address; //Employee HAS-Many Address  
}

See: C# code for association, aggregation, composition

bucyDev
  • 142
  • 8
  • Does it mean that when we use Composition or Dependency, Association is already involved? –  Sep 23 '18 at 09:08
  • 2
    @Aoi see this post: https://www.visual-paradigm.com/guide/uml-unified-modeling-language/uml-aggregation-vs-composition/ – bucyDev Sep 23 '18 at 09:21