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 draw UML Graph Class structure Diagram with Visio

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces how to use Visio to draw UML class structure diagram, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

The relationship between classes

Inheritance relationship

Using Visio to draw UML diagrams is the easiest way to understand inheritance relationships. If you draw a picture, it looks like this. The object-oriented term is is-a relationship. Which means Class2isaClass1. In C++, we say that Class2 is a derivative of Class1, or that Class1 is the base class of Class2.

Aggregation and composition

Start with relationships that are easy to understand. There are often cases where one class is a data member of another lattice class. In UML, it is represented as aggregation and composition.

From the point of view of the graph, when drawing a UML diagram with Visio, these two relationships are shown as a straight line with a diamond at one end. One end of the diamond is the whole, and the other end is the part. The difference is whether the diamond is hollow or solid. Judging from the preface of C++, if the picture is a solid diamond, Class1 will be responsible for the creation and destruction of Class2. More precisely, if Class1 no longer exists, Class2 must not exist either. For example, a program like the following.

ClassClass2 {}; classClass1 {Class2m_objClass2;}

Of course, there are the following situations.

ClassClass2 {}; classClass1 {Class1 (); ~ Class1 (); Class2*m_pClass2Obj;}

It's not enough to just look at the declaration of the class. This depends on the implementation part of the class.

Class1::Class1 () {mclass2ObjnewClass1;} Class1::~Class1 () {deletem_pClass2Obj; mClass2null;}

A Composition relationship is an aggregation relationship if there is no code to destroy the data members when the object of the Class1 is destroyed, such as in the destructor. Of course, there are many kinds of code that destroys data members.

Dependency relationship

To draw a dependency relationship in a UML diagram with Visio is to use another class in one class. For example, the following code

Class1::DoSomething () {Class3obj; obj.DoClass3Work ();}

This is the case. If you draw a picture, it looks like this.

Thank you for reading this article carefully. I hope the article "how to use Visio to draw UML class structure diagram" shared by the editor will be helpful to everyone. At the same time, I also hope you can support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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