DAY 发表于 2019-7-16 16:05:36

UML聚合和组合

聚合

public class Mouse{
}
public class Monitor{
}
public class Compute{
    private Mouse mouse;
    private Monitor monitor;
}


组合

public class Mouse{
}
public class Monitor{
}
public class Compute{
    private Mouse mouse = new Mouse();
    private Monitor monitor = new Monitor();
}

总结:可分离聚合,不可分离组合
页: [1]
查看完整版本: UML聚合和组合