Z
ZBJ2001_KF
Unregistered / Unconfirmed
GUEST, unregistred user!
在HELP中查到
TVarRec = record { do not pack this record
it is compiler-generated }
case Byte of
vtInteger: (VInteger: Integer
VType: Byte);
vtBoolean: (VBoolean: Boolean);
vtChar: (VChar: Char);
vtExtended: (VExtended: PExtended);
vtString: (VString: PShortString);
vtPointer: (VPointer: Pointer);
vtPChar: (VPChar: PChar);
vtObject: (VObject: TObject);
vtClass: (VClass: TClass);
vtWideChar: (VWideChar: WideChar);
vtPWideChar: (VPWideChar: PWideChar);
vtAnsiString: (VAnsiString: Pointer);
vtCurrency: (VCurrency: PCurrency);
vtVariant: (VVariant: PVariant);
vtInterface: (VInterface: Pointer);
vtWideString: (VWideString: Pointer);
vtInt64: (VInt64: PInt64);
end;
下有这样的一个例子:
FUNCTION SUMALL(CONST ARGS:ARRAY OF COSNT):EXTENDED;
VAR
I:INTEGER;
BEGIN
RESULT:=0;
FOR I:=LOW(ARGS) TO HIGH(ARGS) DO
BEGIN
CASE ARGS.VTYPE OF
VTINTEGER:RESULT:=RESULT+ARGS.VINTEGER;
VTCHAR:RESULT:=RESULT+ORD(ARGS.VCHAR);
....
END;
END;
END;
调用是:SUMALL([100*100,'A'])
该函数是通过参数列表中的数会判断出传递的数据类型,然后进行相应的运算.数据类型是VTYPE判断的.不明白?怎么样能VTYPE等于0,1...
我不知道ARGS.VTYPE 的值是怎么得到的.
TVarRec = record { do not pack this record
it is compiler-generated }
case Byte of
vtInteger: (VInteger: Integer
VType: Byte);
vtBoolean: (VBoolean: Boolean);
vtChar: (VChar: Char);
vtExtended: (VExtended: PExtended);
vtString: (VString: PShortString);
vtPointer: (VPointer: Pointer);
vtPChar: (VPChar: PChar);
vtObject: (VObject: TObject);
vtClass: (VClass: TClass);
vtWideChar: (VWideChar: WideChar);
vtPWideChar: (VPWideChar: PWideChar);
vtAnsiString: (VAnsiString: Pointer);
vtCurrency: (VCurrency: PCurrency);
vtVariant: (VVariant: PVariant);
vtInterface: (VInterface: Pointer);
vtWideString: (VWideString: Pointer);
vtInt64: (VInt64: PInt64);
end;
下有这样的一个例子:
FUNCTION SUMALL(CONST ARGS:ARRAY OF COSNT):EXTENDED;
VAR
I:INTEGER;
BEGIN
RESULT:=0;
FOR I:=LOW(ARGS) TO HIGH(ARGS) DO
BEGIN
CASE ARGS.VTYPE OF
VTINTEGER:RESULT:=RESULT+ARGS.VINTEGER;
VTCHAR:RESULT:=RESULT+ORD(ARGS.VCHAR);
....
END;
END;
END;
调用是:SUMALL([100*100,'A'])
该函数是通过参数列表中的数会判断出传递的数据类型,然后进行相应的运算.数据类型是VTYPE判断的.不明白?怎么样能VTYPE等于0,1...
我不知道ARGS.VTYPE 的值是怎么得到的.