简体   繁体   English

UML类图C ++结构

[英]UML Class diagram C++ struct

How can I show struct members in the UML class diagram. 如何在UML类图中显示结构成员。 In class diagram, I added struct as attribute and don't know how to add 'x', 'next' elements to that struct. 在类图中,我将struct作为属性添加,并且不知道如何向该struct添加“ x”,“ next”元素。 if I generate the C++ from class diagram, it should have 'x' and 'next' elements in struct. 如果我从类图生成C ++,则它在struct中应该有“ x”和“ next”元素。

 class LinkList
    {
    private:
      // how to show the struct and its members in UML class diagram
      struct node
      {
         int x;
         node *next;
      }*p;

    public:
      // add an element
      void append(int num);

     // counts number of elements
      int count();
    };

something like this?! 这样的东西? 在此处输入图片说明

and you would just remove the <<ptr>> stereotype and use the * as well, like +next:node* 您只需删除<<ptr>>构造型并使用* ,例如+next:node*

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM