下面是一段代码
unit Unit1
interface
uses
Windows,Messages,SysUtils;
type
TForm1=class(TForm)
private
{Private declarations}
public
{Public declarations}
end;
var
From1:TForm1;
implementation{$R*.DFM}
end1.如果unit1需使用unit2单元内的变量v2,则unit2应如何在unit1中进行声明?
2.外挂DLL库时,声明应写在单元的何处?
3.新建一个内部函数或过程时,其声明部分应写在单元的何处?其代码部分写在单元的何处?
4.语句TForm1=class(TForm)是什么意思?
5.在哪些位置可引用其他单元?
unit Unit1
interface
uses
Windows,Messages,SysUtils;
type
TForm1=class(TForm)
private
{Private declarations}
public
{Public declarations}
end;
var
From1:TForm1;
implementation{$R*.DFM}
end1.如果unit1需使用unit2单元内的变量v2,则unit2应如何在unit1中进行声明?
2.外挂DLL库时,声明应写在单元的何处?
3.新建一个内部函数或过程时,其声明部分应写在单元的何处?其代码部分写在单元的何处?
4.语句TForm1=class(TForm)是什么意思?
5.在哪些位置可引用其他单元?
解决方案 »
- 关于TListView显示的一个奇怪问题
- 如何使TEdit控件显示内容靠右显示?
- ADOQuery真的让人迷惑????
- 关于用Delphi开发ASP应用系统.高手进入讨论!
- 如何截获SQL Server的系统提示错误,并返回中文提示给用户。
- 能否用DELPHI控制USB的电源开关?
- 谁有Windows2000下的softice ?
- Tbutton(sender)是什么意思?
- 请教一个ADO的问题
- 试问有谁知道如何让delphi的代码编写窗口能和VB、VC一样友好?
- 请问怎样可以让 DBgrid 的其中一个 column 显示的是 Checkbox 控件?
- 我是新手,请高手指点,我在编译程序时出现这样的问题,是怎么回事。急!!!!
2.Interface处
3.声明部分写在Interface处,安Ctrl+Shilft+C会自动在implementation添加定义。
4.表示从TForm继承一个类,这个类叫做TForm1
5.Interface和implementation处都可以
1.在Unit2中声明的变量必须是全局变量或类的公有变量,即在Unit2的Interface部分声明的。
4.在Interface中引用的单元一般是系统单元。implementation中引用的是用户自写单元。
在单元循环引用是要分别放在Interface部分和implementation部分!
interface
uses
Windows,Messages,SysUtils;
type
TForm1=class(TForm)
private
{Private declarations}
public
{Public declarations}
end;
var
From1:TForm1;
implementation
uses Unit1;//在这里也行的{$R*.DFM}
procedure ....
begin
with .....TFormName... do
begin
//...要用的代码。
end;
end;end
procedure aaa();
procedure bbb()
begin
//code
end;
begin
bbb();
end;