全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1174
推到 Plurk!
推到 Facebook!

VCL繼承基本觀念問題

答題得分者是:william
cyl
中階會員


發表:163
回覆:171
積分:66
註冊:2002-07-11

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-10-28 08:56:38 IP:202.181.xxx.xxx 未訂閱
Protected: 在 Protected 區域宣告的 內部資料或方法,只有在目前的物件類別或 它的繼承物件類別(inherited class)才可存取 Override method 在子物件類別(descendent class),若要覆蓋(Override)父物件類別 (ancentor class)的方法(method), 請問TDbgrid不是從TCustomGrid繼承而來得嗎?? 為何無法使用 function GetEditText(ACol, ARow: Longint): string; override; 基本觀念不足,請前輩們賜教
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-10-28 09:20:18 IP:147.8.xxx.xxx 未訂閱
Any problem??? BTW, TDBGrid -> TCustomDBGrid -> TCustomGrid .... and GetEditText has been overriden in TCustomDBGrid...
cyl
中階會員


發表:163
回覆:171
積分:66
註冊:2002-07-11

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-10-28 10:06:55 IP:202.181.xxx.xxx 未訂閱
引言: Any problem??? BTW, TDBGrid -> TCustomDBGrid -> TCustomGrid .... and GetEditText has been overriden in TCustomDBGrid...
那是不是代表一但被overriden ,在繼承的後代物件就不可使用此function
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-10-28 10:11:56 IP:147.8.xxx.xxx 未訂閱
[quote]那是不是代表一但被overriden ,在繼承的後代物件就不可使用此function/quote] No, you can use it... Could you give more details on your problem? I have no idea what it is....
cyl
中階會員


發表:163
回覆:171
積分:66
註冊:2002-07-11

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-10-28 12:12:13 IP:202.181.xxx.xxx 未訂閱
我的問題是為何不可以直接寫成 DBGrid1.GetEditText 在http://delphi.ktop.com.tw/topic.php?topic_id=37933 一定要定義一個 DumClass = class(TCustomGrid); strtofloat(DumClass(DBGrid1).GetEditText(MG.X,CG.Y));
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#6 引用回覆 回覆 發表時間:2003-10-28 12:28:23 IP:147.8.xxx.xxx 未訂閱
引言: 我的問題是為何不可以直接寫成 DBGrid1.GetEditText 在http://delphi.ktop.com.tw/topic.php?topic_id=37933 一定要定義一個 DumClass = class(TCustomGrid); strtofloat(DumClass(DBGrid1).GetEditText(MG.X,CG.Y));
Protected method is not going to be used by the 'user'. In Delphi, all classes within the same unit can have full access to other classes (even private and protected area)... So this is essential a trick to access the protected area in TDBGrid.
系統時間:2024-04-29 16:40:00
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!