請問 Uses寫在implementation之前或之後有何不一樣?? |
答題得分者是:william
|
cyl
中階會員 發表:163 回覆:171 積分:66 註冊:2002-07-11 發送簡訊給我 |
unit DllExport; interface uses Windows, Classes, Forms, DllUtils, BaseFrm; type
// Inherited from TInterfacedObject to be reference-counted.
TPlugin = class(TInterfacedObject, IPlugin)
private
FForm: TBaseForm;
public
destructor Destroy; override; function CreateForm(hMainForm: THandle): THandle;
procedure DestroyForm;
function ShowModalForm: Integer;
end; function CreatePlugin(hApp: THandle): IPlugin; export; stdcall; exports
CreatePlugin; var
g_ConcreteClass: TBaseFormClass := nil;
g_PluginIntf: IPlugin = nil;
g_DllAppHandle: THandle; implementation uses Dialogs, SysUtils;
......
..... 請問有時候 Uses寫在implementation下面,請問寫在之前或之後有何不一樣?? 發表人 - ddy 於 2002/11/28 13:41:07 發表人 - ddy 於 2002/11/28 13:53:52
|
william
版主 發表:66 回覆:2535 積分:3048 註冊:2002-07-11 發送簡訊給我 |
You cannot use the type/const defined in a unit before using it. 'Use' after implementation can work around with the circular reference problem. e.g.
unit Unit1; interface uses Unit2 type TMyClass = class .... unit Unit2; .... implementation uses Unit1; .... var A: TObject; begin .... TMyClass(A).xxxx .... end;Since Unit1 has used Unit2, Unit2 cannot use Unit1 in the interface section and the work around is to use Unit1 in the implementation section. 發表人 - william 於 2002/11/20 16:37:53 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |