1. 关联关系
1.1 单向关联
、
public class ClassA { private ClassB bVar; } public class ClassB { //... }
1.2 双向关联
public class ClassA { private ClassB bVar; } public class ClassB { private ClassA aVar; // ... }
1.3 自关联
public class ClassH { private ClassH hVar; }
2. 聚合、组合
2.1 聚合
public class Computer { private CPU cpu; //.... } class CPU { //... }
2.2 组合
public class Database { private ArrayList<Table> tableList; } class Table { }
3. 依赖
public class ClassX { public void funx(ClassY yObj){}; } class ClassY { }
4. 泛化(继承)
5. 实现
时间: 2024-10-19 11:26:04