1.單元和程序(Units和Programs)
1)Programs
program Editor;
uses Forms, REAbout, // An "About" box
REMain; // Main form
{$R *.res}
begin
Application.Title := 'Text Editor';
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end.
2)Unit
unit Unit1;
interface
uses // List of unit dependencies goes here
implementation
uses // List of unit dependencies goes here
// Implementation of class methods, procedures, and functions goes here
initialization
// Unit initialization code goes here
finalization
// Unit finalization code goes here
end.
2.引用Unit到Unit
uses Forms, Main;
uses
Forms,
Main;
uses Windows, Messages, SysUtils, Strings, Classes, Unit2, MyUnit;
3.引用Unit到program or library
uses
Windows, Messages, SysUtils,
Strings in 'C:\Classes\Strings.pas', Classes;
4.Unit間接引用
program Prog;
uses Unit2;
const a = b;
//...
unit Unit2;
interface
uses Unit1;
const b = c;
//...
unit Unit1;
interface
const c = 1;
//...
5.Unit的嵌套引用
unit Unit1;
interface
uses Unit2;
// ...
unit Unit2;
interface
uses Unit1;
// ...