[問題] 請教關於Axel-Tobias Schreiner的OOP一書
小弟最近在拜讀Axel-Tobias Schreiner的Object-oriented Programming in ANSI-C,
殊不知看不太懂作者想要表達的想法與觀念,故想上網請教前輩們。
附上pdf網址:https://www.cs.rit.edu/~ats/books/ooc.pdf
在PDF第7頁,"Alternatively, we can define a data type as a set of values plus
operations to work with them."
data type可以定義為一組數值+上與數值的運算,不太懂這句話想要表達的含意是什麼(註
:我只會C,不會C++)
對我來說data type就是最基本的int, char,double與float,其餘像是array, struct,
union都是最基本的延伸的變化型。
接著在下列的這句話"Typically, the values are what a computer can represent, and
the operations more or less reflect the available hardware instructions. int in
ANSI-C does not do too well in this respect: the set of values may vary between
machines, and operations like arithmetic right shift may behave differently."
第二句看不懂,operation體現出可使用的硬體指令?為什麼ANSI-C的int在這方面做得不太
好?是哪方面?
接著,"More complicated examples do not fare much better. Typically we would
define an element of a linear list as a structure"
作者說明更複雜的data type進展的也不是很好,並舉例了一個例子:
typedef struct node {
struct node * next;
... information ...
} node;
and for the operations we specify function headers like
node * head (node * elt, const node * tail);
作者說明,這個方法相當馬虎,好的原則應該是要隱藏data item的representation且只
declare possible manipulations.
問題1: 什麼是 linear list? 為什麼這個struct是linear list的一種?
問題2: head應該是指向一個函式的指標吧?
問題3: 所以operation不是指+ - * /這類的?
問題4: 這個例子的representation of data item是那些東西?
問題5: only declare possible manipulation是指什麼意思?
問題6: 為什麼這個方法會相當馬虎? 哪邊馬虎?
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 60.248.26.157
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1502782305.A.C87.html
→
08/15 15:38, , 1F
08/15 15:38, 1F
我知道什麼是Linked-list
※ 編輯: zzss2003 (60.248.26.157), 08/15/2017 15:40:46
→
08/15 16:36, , 2F
08/15 16:36, 2F
我不確定...所以才上來問版友@@
※ 編輯: zzss2003 (60.248.26.157), 08/15/2017 16:54:59
推
08/15 19:05, , 3F
08/15 19:05, 3F
推
08/15 19:11, , 4F
08/15 19:11, 4F
→
08/15 19:11, , 5F
08/15 19:11, 5F
→
08/15 19:12, , 6F
08/15 19:12, 6F
→
08/15 19:12, , 7F
08/15 19:12, 7F
→
08/15 19:13, , 8F
08/15 19:13, 8F
→
08/15 23:19, , 9F
08/15 23:19, 9F
→
08/15 23:21, , 10F
08/15 23:21, 10F
→
08/15 23:22, , 11F
08/15 23:22, 11F
→
08/15 23:23, , 12F
08/15 23:23, 12F
→
08/15 23:28, , 13F
08/15 23:28, 13F
推
08/16 13:32, , 14F
08/16 13:32, 14F
→
08/16 14:07, , 15F
08/16 14:07, 15F
推
08/16 14:34, , 16F
08/16 14:34, 16F
→
08/16 14:34, , 17F
08/16 14:34, 17F
→
08/16 14:35, , 18F
08/16 14:35, 18F
→
08/16 15:57, , 19F
08/16 15:57, 19F
→
08/16 15:57, , 20F
08/16 15:57, 20F
→
08/16 15:58, , 21F
08/16 15:58, 21F
→
08/16 15:58, , 22F
08/16 15:58, 22F
推
08/16 16:12, , 23F
08/16 16:12, 23F
→
08/16 16:12, , 24F
08/16 16:12, 24F
→
08/16 16:13, , 25F
08/16 16:13, 25F
→
08/16 16:13, , 26F
08/16 16:13, 26F
→
08/16 16:14, , 27F
08/16 16:14, 27F
→
08/16 16:15, , 28F
08/16 16:15, 28F
推
08/16 18:56, , 29F
08/16 18:56, 29F
→
08/16 18:56, , 30F
08/16 18:56, 30F
→
08/16 18:56, , 31F
08/16 18:56, 31F
→
08/16 18:56, , 32F
08/16 18:56, 32F
→
08/16 18:59, , 33F
08/16 18:59, 33F
→
08/16 18:59, , 34F
08/16 18:59, 34F
我現在就是還在初階段XD沒有啊...阿...嘶我懂我懂的感覺QQ
※ 編輯: zzss2003 (60.248.26.157), 08/18/2017 13:11:25
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章