Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to express the relation of UML diagram

2025-03-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of "how to express the relationship of UML diagram". The editor shows you the operation process through an actual case, the operation method is simple and fast, and it is practical. I hope this article "how to express the relationship of UML diagram" can help you solve the problem.

First, the dependence in the UML diagram relationship: dotted arrow. The end with the arrow is the dependent relationship.

The code shows that in one class, the parameter of a method is the type of another class (or several classes).

PblicclassA {publicintSales (classBclsB) {} REMsales is a function in classA}

Second, inheritance in UML graph relation: hollow triangle + solid line representation. The end with a triangle is the heir.

The code shows that a class is declared with ":" and the class name of the inherited class.

For example: classbird:animal.

Third, aggregation in UML diagram relationship: hollow diamond + solid line arrow. The other end of the arrow is the included object. That is, object A can contain object B, but object B is not necessarily part of object A.

The code shows that there are objects of another class in one class, and you can make an array of objects.

PublicclassclassA {publicclassB () clsB}

4. Composition (combination) in UML diagram relation: solid diamond + solid line arrow. The other end of the arrow is the combined object.

The code shows that in class A, class B is instantiated during initialization. They are generated at the same time. (how do I generate Class A? ).

PublicclassclassA {privateclassBclsB {clsB=newclassB ();}}

Fifth, the association in the UML diagram relationship: solid line arrow. The end of the arrow represents the referenced object. One class needs to know another class.

Code representation: in one class, reference to another class. (how do I reference a class? ) for example:

Classclass1 {privateclass2cls1;}

Sixth, the interface in UML diagram relationship: hollow triangle + dashed line. The other end of the triangle is the definition interface class.

Code embodiment: when defining a class, add ":" and interface name. Override a method in an interface in a class.

This is the end of the content about "how to express the relationship of UML diagrams". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report