我有这个代码:
type
TMyClass = class
private
procedure SetKeyValue(const Key: WideString; Value: Widestring);
function GetKeyValue(const Key: WideString): WideString;
public
// this works
property KeyValue[const Index: WideString] : WideString read GetKeyValue write SetKeyValue;
// this does not compile
// [Error]: Incompatible types: 'String' and 'Integer'
property Speed: WideString index 'SPEED' read GetKeyValue write SetKeyValue;
end;
Run Code Online (Sandbox Code Playgroud)
该Speed属性给我错误:
不兼容的类型:'String'和'Integer'
我需要索引是字符串.是否可以使用indexwith字符串值?
| 归档时间: |
|
| 查看次数: |
837 次 |
| 最近记录: |