線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1190
推到 Plurk!
推到 Facebook!

有關繼承

答題得分者是:william
QOO10
初階會員


發表:59
回覆:89
積分:29
註冊:2002-12-25

發送簡訊給我
#1 引用回覆 回覆 發表時間:2002-12-30 14:13:35 IP:61.229.xxx.xxx 未訂閱
各位高手好.       若原 A 繼承 B ,B 繼承 C 後來 B 改繼承 E 那是不是更改如下就 OK!!] TYPE   B=class(C)  -----> B=class(e) 
william
版主


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

發送簡訊給我
#2 引用回覆 回覆 發表時間:2002-12-30 14:20:37 IP:147.8.xxx.xxx 未訂閱
Yes
QOO10
初階會員


發表:59
回覆:89
積分:29
註冊:2002-12-25

發送簡訊給我
#3 引用回覆 回覆 發表時間:2002-12-30 14:54:19 IP:61.229.xxx.xxx 未訂閱
引言:
引言: 各位高手好. 若原 A 繼承 B ,B 繼承 C 後來 B 改繼承 E 那是不是更改如下就 OK!!] TYPE B=class(C) -----> B=class(e) < face="Verdana, Arial, Helvetica"> QOO10: 有沒有具體實例
有,但有問題,我在 try 原因:如下 FCust 繼承 SNGTBFORM , SNGTBFORM 繼承 ENTERFORM BUT 無法設 ENTERFORM 之 property 如下: udtype.pas ----------------------------------------------------------------------unit udType; interface type F10FLAG=(dInvtory,dClient,dBrand,dGroup,dSuplyer,dAcmaster,dCountry, dStaff,dDept,dPhrase,dBank,dEmpty); implementation end. ENTERFORM SOURCE --------------------------------------------------------------------------- unit enterformu interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,StdCtrls, adstable, Db, TypInfo,dbctrls,Grids, DBGrids, Mask,udtype; ------->User Define type type TEnterForm = class(TForm) private F10Point:F10FLAG; //pty; { Private declarations } protected public Published Property pf10point:F10FLAG read F10Point write 10Point; end; -------------------------------------------------------------------- unit SNGTBFORMU interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Buttons, ToolWin, ComCtrls, ExtCtrls, StdCtrls, DBCtrls, Enterformu,udtype; ---------->enterform unit type TSNGTBFORM = class(TEnterForm) . . . --------------------------------------------------------------------------- unit FCust; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Db, ExtCtrls, Buttons, ToolWin,ComCtrls, DBCtrls, StdCtrls, Mask,udtype,SNGTBFORMU; type TFCUST = class(TSNGTBFORM) ... ... procedure TFCUST.dbeCli_CurrnoEnter(Sender: TObject); begin inherited; pf10point:=dCountry; // -> 此行掛了又是type error(incompatible type) end;
william
版主


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

發送簡訊給我
#4 引用回覆 回覆 發表時間:2002-12-30 15:04:42 IP:147.8.xxx.xxx 未訂閱
Myabe dCountry is defined elsewhere with the same name? Try it: pf10point := udType.dCountry;
QOO10
初階會員


發表:59
回覆:89
積分:29
註冊:2002-12-25

發送簡訊給我
#5 引用回覆 回覆 發表時間:2002-12-30 15:16:49 IP:61.229.xxx.xxx 未訂閱
引言: Myabe dCountry is defined elsewhere with the same name? Try it: pf10point := udType.dCountry;
感謝各位用 pf10point := udType.dCountry; 就 ok 了,但 我在 SNGTBFORMU 就不需為什麼如此??
ccchen
版主


發表:61
回覆:940
積分:1394
註冊:2002-04-15

發送簡訊給我
#6 引用回覆 回覆 發表時間:2002-12-30 15:22:33 IP:61.219.xxx.xxx 未訂閱
1. pf10point:=dCountry; // -> 此行掛了又是type error(incompatible type) 我看沒問題, 應該是同名的參數重複宣告, 找看看 2. 好像與原來問題無關 若原 A 繼承 B ,B 繼承 C 後來 B 改繼承 E 那是不是更改如下就 OK!!] TYPE B=class(C) -----> B=class(e) 更改繼承是沒有問題, 但在Delphi整合環境中更改Form之繼承就要小心 例如: TFormA=class(TForm1); TFormB=class(TForm1); TFormC=class(TForm1); 如果你改成TFormA=class(TForm2);, 可能TFormb,TFormC都同時改了, 我都是離開Delphi用NOTEPAD改
william
版主


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

發送簡訊給我
#7 引用回覆 回覆 發表時間:2002-12-30 15:25:45 IP:147.8.xxx.xxx 未訂閱
引言: 感謝各位用 pf10point := udType.dCountry; 就 ok 了,但 我在 SNGTBFORMU 就不需為什麼如此??
In SNGTBFORMU, udType is at the end of the uses clauses such that the compilter will treat dCountry as uType.dCountry. Perhaps you have re-used the name "dCountry" elsewhere (say, unit1) and udType appear before unit1 in the use clauses.
系統時間:2024-05-05 12:01:53
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!