gpt4 book ai didi

java - 类和抽象数据类型之间的区别

转载 作者:行者123 更新时间:2023-12-02 06:43:22 24 4
gpt4 key购买 nike

谁能告诉我抽象数据类型和接口(interface)之间的区别吗?我遇到了一个奇怪的问题,那就是我无法区分抽象数据类型和类?我们可以用ADT创建一个类或者ADT本身就是一个类吗?

最佳答案

抽象数据类型是一个通用数学术语,描述具有 Java 类(在某种程度上)体现的属性的实体。因此,您可以将 Java 类视为 ADT 概念的实现示例。来自 Wikipedia 的一些相关引用:

An abstract data type is defined indirectly, only by the operations that may be performed on it and by mathematical constraints on the effects (and possibly cost) of those operations.

Abstract data types are purely theoretical entities, used (among other things) to simplify the description of abstract algorithms, to classify and evaluate data structures, and to formally describe the type systems of programming languages. However, an ADT may be implemented by specific data types or data structures, in many ways and in many programming languages.

关于java - 类和抽象数据类型之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18900649/

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