#组合关系(composition)
class Wing(object):
    pass

class Bird(object):
    def __init__(self):
        self.wing = Wing()

 Composition(组合关系)是关联关系的一种,是比聚合关系强的关系。它要求普通的聚合关系中代表整体的对象负责代表部分的对象的生命周期。Bird的生命周期决定了self.wing的生命周期

相关文章:

  • 2021-08-28
  • 2022-01-25
  • 2021-10-17
  • 2021-10-19
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-19
  • 2022-01-17
  • 2021-02-04
  • 2019-12-16
  • 2022-01-28
相关资源
相似解决方案