What is aggregation?

1 answers

Aggregation is the typical whole/part relationship. This is exactly the same as an association with the exception that instances cannot have cyclic aggregation relationships.

Sample class Person is shown below to demonstrate Aggregation relationship with Address.

Person class

public class Person
{  
  private Address address;
 
}
 
class Address
{
  private String city;
   
  private String state;
   
  private String country;
   
  private String line1;
   
  private String line2;
 
}
shilpigupta22 shilpigupta22 [Author] 4 months ago votes 0