更新时间:2022-09-13 21:08:28
两个类之间的关系,例如类A和B。
如果是B是A成员变量,而且B在A的构造函数中生成(new),那么就是Composition。
如果是B是A成员变量,而且B不在A的构造函数中生成(new),而是在有需要的时候才new,那么就是Aggregation。
如果A在某个函数中使用了B作为局部变量,那么就是Dependency。
其实设计的时候是反过来,先决定这两个类之间的关系,在有编程语言的实现。
本文转自Jake Lin博客园博客,原文链接:http://www.cnblogs.com/procoder/archive/2009/04/26/1444021.html,如需转载请自行联系原作者
Maven错误Failed to read artifact descriptor for xxx:jar 和 missing artifact maven dependency
Association, Composition and Aggregation in UI5, CRM, S/4HANA and C4C
我的mqtt协议和emqttd开源项目个人理解(17) - [error] Dependency luerl is specified as a dependency but is not...
Inheritance, Association, Aggregation, and Composition 类的继承,关联,聚合和组合的区别
使用-MM生成include指令和依赖生成(make include directive and dependency generation with -MM)
maven可选依赖(Optional Dependencies)和依赖排除(Dependency Exclusions)