作者PsMonkey (痞子军团团长)
看板java
标题Re: [问题] 自订ADT运算符号
时间Fri Nov 10 23:53:58 2006
※ 引述《capslook1218 (一直当朋友也不错)》之铭言:
: ※ 引述《qrtt1 (愚人)》之铭言:
: : 呃,二位用的语境不太相同
: : PsMonkey大概想指出java没有[提供使用者]
: : cpp那样operator overloading的功能
: : 而"一直当朋友也不错"(好人!?)
: : 指的ADT的"加号"
: : 其实对ADT来说,只是规范这个abstract data type
: : 所允许的一种加法运算的功能
: : (请注意,ADT描述的是功能,而非如何实作)
: : *请用method的方式为你的ADT加上这个功能*
: 我的意思是说能不能自订"+ - * /"这样的符号
: 然後如果不能的话
: 是不是就要用ADT做(也可以不用)
虽然说我资料结构没学好
(偏偏现在还在带资料结构助教课 XD)
不过这个 ADT 应该是资料结构的 ADT 吧?
根据 Fundamentals of Data Structures in C 这本书 p.15 提供的定义
An abstract data type (ADT) is a data type that is organized
in such a way that the specification of the objects and the
specification of the operation on the objects is separated
from the representation of the objects and the implementation
of the operations.
下面还写:
Some programming languages provide explicit mechanisms to
support the distinction between specification and implementation.
For example, Ada has a concept called a package, and C++ has a
concept called a
class.
C++ 的 class 应该跟 Java 的 class 完全等价
所以,当 qrtt1(大神)回你那篇之後
你这篇仍然说「是不是就要用 ADT 作」
这... 似乎有点囧....
: 之後我打着打着又想到说API说不定会有这个东西
: 我跑去查...没找到(可能我功力不够吧~_~我是找math里面的东西可是好像没看到~_~)
: 英文太烂了....
: ps:一直当朋友也不错.....这是我心中的痛别提了......不过我不敢自称是好人
: 感谢两位大大的讲解
--
战略高手 -- CompScience 组组长 PsMonkey
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.228.192.29