delegation的兄弟姐妹


Delegation分为

*Use(A use B)

*Association(A has B)

*Composition/aggregation(A owns B)

dependencyt

通过方法的参数传递建立联系,进行调用

association

class中有固有的field,可以是外界传入的参数,也可以使用自带的参数

composition

association加强版,不可以外界传入,只能用自己的field

aggregation

可以在过程中更改方法中参数值,更灵活


Author: John Doe
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint policy. If reproduced, please indicate source John Doe !
  TOC