Relationship in class diagram

Source: Internet
Author: User
Links in a class diagram refer to the relationships between classes, classes, and interfaces, and between interfaces.

Link:
1. General Relationship: Generalization
Applicable to: classes, classes, and interfaces; between interfaces
It indicates the inheritance relationship.
Symbol: a hollow triangle points to the parent class by a subclass, or a class points to an interface.
Implementation in Java: implements, extends

2. Association: Association
Applicable to: between classes
Indicates the connection between classes, so that one class knows the attributes and methods of the other class.
Symbol:Solid line.There are arrows and base multiplicity. Tables can have several instances. Direction available, one-way, two-way
JAVA Implementation: pointing to an instance variable in the class that is directed to the class

3. Aggregation: Aggregation
Applicable to: between classes
Indicates the connection between classes, so that one class knows the attributes and methods of the other class.+ Relationship between the table and individual.
Symbol:Solid line.There are arrows and base multiplicity. Tables can have several instances. Direction available, one-way, two-way +The arrow pointing to the class is a hollow triangle.
JAVA Implementation: pointing to an instance variable in the class that is directed to the class
Others: stronger Association

4. compositing relationship: composition
applicable to: Class and Class
meaning: indicates the connection between classes, so that one class knows the attributes and methods of the other class. + relationships between the table and individual. + indicates that the entire object represents the lifecycle of some objects.
Symbol: solid line. There are arrows and base multiplicity. The table can have several instances. Direction available, one-way, two-way + the arrow pointing to the class is a solid triangle.
JAVA Implementation: pointing to a class with an instance variable pointing to the class
others: 1. stronger aggregation Relationship 2. at any time, some objects can only combine with one whole object. 3. the compositing link cannot be shared!


5. dependency: dependency
applicable to: between classes
meaning: indicates that one class depends on the definition of another class.
Symbol: dotted line. There are arrows and base multiplicity. The table can have several instances. Direction available, one-way, two-way
JAVA Implementation: 1. local variable, 2. parameters of the method, 3. call a static method

others: Dependency: dependency and dependency: association: whether the class is a local variable or an instance variable

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.