我有这个:
AVAudioSession.SharedInstance().SetPreferredSampleRate(16000,out NSError sampleHardwareErr2);
然后是一堆type
TFuncGetData = function: Integer of object;
function TFrmAPI.GetExactData(AFunc: TFuncGetData): Integer;
var lStatus: Integer;
begin
FErrorMsg := '';
lStatus := AFunc;
...
这样的
TFuncGetData
被叫到
function TFrmAPI.getcurrentDivision: Integer;
begin
...
现在,所有这些lResult := GetExactData(getcurrentDivision);
都需要一个参数来传递信息:
TFuncGetData
但是函数type
TFuncGetData = function(ASelProps: TSelectionProperties): Integer of object;
function TFrmAPI.getcurrentDivision(ASelProps: TSelectionProperties): Integer;
begin
...
现在通过GetExactData
在lStatus :=aFunc
调用中阻塞。
我看到两种解决方法:
- 定义一个
E2035 Not enough actual parameters
,将其设置并让TFrmAPI.fselectionProperties
使用它 - 通过调用传递TSelectionProperties(例如here):
。
GetExactData
第二种方法更安全(因为可能会覆盖TFrmAPI.fselectionProperties),但是还有其他更好的方法来构造它吗?