implementation ISR* DFM 单 var 仅供单元内部使用 function Temp. total: integer begin 元 total: -emp. sal*12 end procedure TForm1. Button Click(Sender: TObject) begin emp. sal: =10 showmessage(inttostr(emp. total)) end end
implementation {$R *.DFM} uses var 仅供单元内部使用 function Temp.total :integer; begin total:=emp.sal*12; end; procedureTForm1.Button1Click(Sender:TObject); begin emp.sal:=10 ; showmessage(inttostr(emp.total)); end; end. 单 元 }
ProjectI UnitI Procedure 1 变量作用域 Ocedure Procedure3 Unit2 Procedure 4 P rocedure Procedure
Project1 Unit1 Unit2 Procedure2 Procedure3 Procedure1 Procedure4 Procedure5 Procedure6 变量作用域
Initialization begin 单 emp: temp. create end 元 finalization b egin emp. free end end
Initialization begin emp:=temp.create; end; finalization begin emp.free; end; end. 单 元
常用运算符 算术运算符+-*/diⅳv(整除)md 字符串运算符+ 集合运算符+-*in 对象类型判别is 例 procedure Tformlclicksender: Tobject) Begin if sender is tbutton then Tbutton(sender). Height: =50 d en
常用运算符 • 算术运算符 + - * / div(整除〕 mod • 字符串运算符 + • 集合运算符 + - * in • 对象类型判别 is • 例: procedure Tform1.cclick(sender:Tobject); Begin if sender is Tbutton then Tbutton(sender).Height:=50; end;
对象 属性一状恋鳥 方法 动作傖鳥 事件一对泉之间传递的信鳥
对象 属性 - 状态信息 方法 - 动作信息 事件 - 对象之间传递的信息