何謂欄位變動的記錄型態 |
尚未結案
|
hkstm
一般會員 發表:23 回覆:31 積分:10 註冊:2002-03-15 發送簡訊給我 |
type
tperson = record
name:string[5];
birthday:tdate;
case happy:boolean of
true: (birthplace:string[20]);
false:(country:string[10];
join:string[10];
joindate,getoutdate:tdate);
end;
請問如果宣告像這樣用欄位變動的記錄有什麼好處,而且在實作區
到底要怎麼譔寫,才能使用case ... of 敘述句裏的變數…。
實在搞不懂…謝謝。
|
william
版主 發表:66 回覆:2535 積分:3048 註冊:2002-07-11 發送簡訊給我 |
|
hkstm
一般會員 發表:23 回覆:31 積分:10 註冊:2002-03-15 發送簡訊給我 |
剛試了一下…果真如此
版主所說的是"或"的意思嗎
那請問用欄位變動一定要記錄型態嗎?因為對於均由同一個記憶體位置開始
讀取資料看不懂:
是
-- type
| tperson = record
| name:string[5];
-- birthday:tdate
還是
-- case happy:boolean of
| true: (birthplace:string[20]);
| false:(country:string[10];
| join:string[10];
-- joindate,getoutdate:tdate);
這二部份裏面的欄位是沒有交集?所以只能擇其一?問的很模糊:希望看的懂
|
william
版主 發表:66 回覆:2535 積分:3048 註冊:2002-07-11 發送簡訊給我 |
No, it is not "或". You may want to look for "Variant parts in records" in Delphi help class="code">TRect = packed record
case Integer of
0: (Left, Top, Right, Bottom: Integer);
1: (TopLeft, BottomRight: TPoint);
end; ARect.Left and ARect.TopLeft.X are referring to the same value/memory.
|
hagar
版主 發表:143 回覆:4056 積分:4445 註冊:2002-04-14 發送簡訊給我 |
|
hkstm
一般會員 發表:23 回覆:31 積分:10 註冊:2002-03-15 發送簡訊給我 |
|
ha0009
版主 發表:16 回覆:507 積分:639 註冊:2002-03-16 發送簡訊給我 |
你好:
如果上面的說明你能不明白,這篇 http://delphi.ktop.com.tw/topic.php?TOPIC_ID=32757內容也有提到相關解答。如果你的問題已獲解答,記得給分結案喔 < src="http://sourceprovide.deepen.com.tw/K_Top/bp.gif">
|
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |