Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

The difference between association and dependency

Shulou Source: shulou.com Published: 2022-06-03 06:15:13 09月24日 Update

Relationship: class A needs an object reference or pointer of class B as a parameter when it is instantiated

Dependency: a method of class A uses class B, either because the parameter of the method is class B or because an instance of class B is obtained in the method

A class appears in another class in the form of member variables, the two are associated; a class appears in the form of local variables in another class, the two are dependent.

Aggregation relationship: weak correlation, whole and part can exist independently

Combinatorial relationship: strong relevance, the whole and the part are inseparable and cannot exist independently.

Tags: Association method parameter variable instance form whole part independent indivisible object local come member pointer time combination Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Microsoft Redmi vpn MariaDB