本文介绍了UML类图C ++结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在UML类图中显示结构成员。在类图中,我将struct作为属性添加,但不知道如何向该struct添加 x, next元素。如果我从类图生成C ++,则它在结构中应该包含'x'和'next'元素。
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();
};
推荐答案
是这样的吗?
something like this?!
您只需删除<< ptr>>
原型,并使用 *
,例如 + next:node *
and you would just remove the <<ptr>>
stereotype and use the *
as well, like +next:node*
这篇关于UML类图C ++结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!