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

關於procedure 的小問題

 
MidasFan
一般會員


發表:41
回覆:22
積分:12
註冊:2004-06-03

發送簡訊給我
#1 引用回覆 回覆 發表時間:2006-10-25 11:47:27 IP:61.222.xxx.xxx 訂閱
procedure TSFUNC001_SEL.GetAutoNum6CallMethod(Params: Variant;out ReturnVal: Variant);
請問一下各位先進:
out ReturnVal: Variant 這一個out是代表什麼意思呀
謝謝喔
Fishman
尊榮會員


發表:120
回覆:1949
積分:2163
註冊:2006-10-28

發送簡訊給我
#2 引用回覆 回覆 發表時間:2006-10-25 15:00:12 IP:210.65.xxx.xxx 未訂閱
Help in Delphi for Out parameters:
Out parameters

An out parameter, like a variable parameter, is passed by reference. With an out parameter, however, the initial value of the referenced variable is discarded by the routine it is passed to. The out parameter is for output only; that is, it tells the function or procedure where to store output, but doesn’t provide any input.
For example, consider the procedure heading

procedure GetInfo(out Info: SomeRecordType);
When you call GetInfo, you must pass it a variable of type SomeRecordType:
var MyRecord: SomeRecordType;
...
GetInfo(MyRecord);

But you’re not using MyRecord to pass any data to the GetInfo procedure; MyRecord is just a container where you want GetInfo to store the information it generates. The call to GetInfo immediately frees the memory used by MyRecord, before program control passes to the procedure.
Out parameters are frequently used with distributed-object models like COM and CORBA. In addition, you should use out parameters when you pass an uninitialized variable to a function or procedure.




Fishman
------
Fishman
系統時間:2024-04-25 8:20:18
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!