Class 图和对象图

Class Diagram and Object Diagram

我正在使用 classes 和对象在 UML 中制作结构图,想知道我是否做对了。

以下(右侧)是否是表示左侧 class 图对象图的正确方法?

没有。您正在使用并非如此的概括。要么将其排除在外,要么使用刻板的依赖关系 <<instanceOf>>。请注意,根据 UML 规范,这不是标准。但是这些规格让你可以自由表达。

实例化对象的 class 已显示在名称 objectName::className 中。

来自附件 A p. UML 2.5 规范的 683,它描述了图表类型的组织:

NOTE. This taxonomy provides a logical organization for the various major kinds of diagrams. However, it does not preclude mixing different kinds of diagram types, as one might do when one combines structural and behavioral elements (e.g., showing a state machine nested inside an internal structure). Consequently, the boundaries between the various kinds of diagram types are not strictly enforced.