我有一个这样的课:
Component = class(TObject)
Name: string;
CurState: word;
States: array of state;
constructor Create(nm: string);
procedure AddState(ccl: bool; const InB: BufArr; const OutB: BufArr);
function GetStateCount(): Integer;
end;
Run Code Online (Sandbox Code Playgroud)
States是一个数组state,也是一个类声明.
State = class(TObject)
InBuf: BufArr;
OutBuf: BufArr;
Cycle: bool;
constructor Create(ccl: bool; const InB: BufArr; const OutB: BufArr);
end;
Run Code Online (Sandbox Code Playgroud)
每个都component可以容纳多个state,这就是为什么我有一个数组state.
该GetStateCount()函数应返回组件所具有的状态数.实现如下:
function Component.GetStateCount(): Integer;
begin
result:=Length(States);
end;
Run Code Online (Sandbox Code Playgroud)
但是,当我在另一个过程中调用此函数时,我收到以下错误:
我似乎无法弄清楚这个原因.将不胜感激任何帮助.
好的,这是我调用函数的代码的一部分:
for i:=0 to nc-1 do
begin
cycle:=false;
len:=cmp[i].GetStateCount;
for j:=0 …Run Code Online (Sandbox Code Playgroud)