UML class diagram and class relationship

class representation



 Interface representation



 or



Relationship between classes (coupling from strong to weak)

Inheritance: is a relationship



 

accomplish:



 

Composition: The contains a relationship indicates that the two objects are a strong relationship between the whole and the part, and the life cycle of the part cannot go beyond the whole, or cannot exist without the whole. The "parts" of the composition relationship cannot be shared among the whole

person combined eye

 

Aggregation: The has a relationship indicates a weak relationship between two objects that is a whole and a part, and the life cycle of a part can transcend the whole. such as computers and mice.

computer aggregates mouse

 

Association: The student is associated with the course, that is, the student only has a reference to the course



 

Dependency: A method parameter of A is B, indicating that A depends on B



 The order of strength and weakness of various relationships:

 Generalization = Implementation > Composition > Aggregation > Association > Dependency

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326965392&siteId=291194637