【发布时间】:2019-07-31 11:57:21
【问题描述】:
我正在做一个uml 类图。
我有一个类,我有变量和多个构造函数。
那些要包含在uml 类图中吗?
如果是,
这样好吗?
<<constructor>> Cells()
<<constructor>> Cells(int)?
【问题讨论】:
标签: class constructor uml diagram
我正在做一个uml 类图。
我有一个类,我有变量和多个构造函数。
那些要包含在uml 类图中吗?
如果是,
这样好吗?
<<constructor>> Cells()
<<constructor>> Cells(int)?
【问题讨论】:
标签: class constructor uml diagram
视情况而定。
有时不显示,有时显示为常规方法,有时显式显示为特殊功能。
刻板印象和注释是你的朋友。
..........................................................
..........................................................
......+----------------------------------------+---+......
......|........................................|...|......
......|..This is the default constructor.......+---*---+..
......|............................................|...|..
......+--------------------------------------------+...|..
.......................................................|..
.......................................................|..
..+-------------------------------------------------+..|..
..|...............<<..class..>>.....................|..|..
..|.................MyVideoGame.....................|..|..
..+-------------------------------------------------+..|..
..|..+....MyVideoGame( )...........<<constructor>>..*--+..
..|..+.... MyVideoGame (int this)..<<constructor>>..|.....
..+-------------------------------------------------+.....
..|..+....~MyVideoGame( )...........<<destructor>>..*--+..
..+-------------------------------------------------+..|..
.......................................................|..
.......................................................|..
.......+-----------------------------------------+-----+..
.......|.........................................|.....|..
.......|..This is the default destructor.........+-----*..
.......|...............................................|..
.......+-----------------------------------------------+..
..........................................................
..........................................................
请注意,我使用“c++”风格的构造函数和析构函数,但也适用于另一个 P.L.
U.M.L.让您可以根据项目要求灵活地显示模型。
请忽略多余的点,用于格式化图表。
【讨论】: