代码中的聚合和关联是什么?(Java或C#)
我找不到“聚合和关联”的代码示例。
答案 0 :(得分:1)
协会示例:员工有地址
public class Employee
{
public Address address; //Employee HAS-A Address
}
汇总示例:员工有很多地址
public class Employee
{
public List<Address> address; //Employee HAS-Many Address
}