gpt4 book ai didi

class-design - class和dataType有什么区别

转载 作者:行者123 更新时间:2023-12-04 03:44:40 26 4
gpt4 key购买 nike

当我阅读UML规范时:

 class has a set of attributes/operations
and data type has a set of attributes/operations

1)关于数据类型的属性/操作
这是什么意思?

因为我不知道这样的数据类型如何具有属性和操作?

2)类和数据类型之间的主要区别是什么?

最佳答案

根据UML 2.4.1规范

A data type is a special kind of classifier, similar to a class. It differs from a class in that instances of a data type are identified only by their value. All copies of an instance of a data type and any instances of that data type with the same value are considered to be equal instances. Instances of a data type that have attributes (i.e., is a structured data type) are considered to be equal if the structure is the same and the values of the corresponding attributes are equal. If a data type has attributes, then instances of that data type will contain attribute values matching the attributes.



1)数据类型的属性/操作与类的属性/操作具有相同的含义,即属性表示数据类型的结构,而操作表示数据类型上可用的方法。

2)类和数据类型之间的主要区别在于,不可能有一个数据类型的两个实例具有相同的值(这些实例将是一个唯一的实例)。

希望能有所帮助,

RB

关于class-design - class和dataType有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15780435/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com