Six relationships in a UML class diagram

Source: Internet
Author: User

Original

Inheritance: Solid line of the hollow triangle arrow. The Child class points to the parent class. Common keywords in code are extends (Java ).

Implementation: Dotted line of the hollow triangle arrow to implement class pointing interface. The implements keyword (Java) is usually used in the code ).

Association: Generally, the instance of another class B needs to be referenced in Class A as a member variable, indicating that Class A needs to "know" Class B. The solid arrow. Class A points to Class B.

DependencyGenerally, a method in Class A requires an instance of Class B as its parameter or variable, and Class A itself does not need to reference an instance of Class B as its member variable. The dotted arrow points to Class B.

 

Aggregation: Generally, Class A needs to include an instance or a set of instances of another class B, indicating a weak "ownership" relationship, that is, Class A contains Class B, but Class B is not a part of Class A, but an independent class. The solid arrow with a hollow diamond tail points to Class B.

Synthesis: Class B is usually instantiated in its constructor while Class A is instantiated, so that Class B is a part of Class A and represents a strong "ownership" relationship, that is, Class B is a part of Class A, which has a strict "Whole-part" relationship. The implementation arrow at the end is solid diamond, and Class A points to Class B.

(Conversion) Six relationships in UML class diagrams

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.