UML Class diagram C++ struct

2019-01-19 22:43发布

问题:

How can I show struct members in the UML class diagram. In class diagram, I added struct as attribute and don't know how to add 'x', 'next' elements to that struct. if I generate the C++ from class diagram, it should have 'x' and 'next' elements in struct.

 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();
    };

回答1:

something like this?!

and you would just remove the <<ptr>> stereotype and use the * as well, like +next:node*



标签: c++ uml