作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我定义了这个类
TParamType = (ptDriverID, ptServer, ptHost, ptUser, ptPassword, ptPort, ptDatabase, ptOSAuth, ptPooled, ptUnicode);
TDataType = (dtInteger, dtString, dtBoolean, dtYesNo, dtPassword);
TParam = record
Index: Byte;
Typ: TParamType;
RegKeyName: String;
ConnName: String;
DataType: TDataType;
Caption: String;
Value: String;
Text: String;
Default: String;
Basic: Boolean;
Enabled: Boolean;
Mandatory: Boolean;
end;
TParams = class(TObject)
private
FParam: array of TParam;
function GetParam(Index:Byte): TParam;
procedure SetParam(Index:Byte;Value:String;Text:String);
public
constructor Create;
destructor Destroy;
property Param[Index: Byte]: TParam read GetParam write SetParam;
procedure Enable(ServerType:TServerType);
end;
property Param[Index: Byte]: TParam read GetParam write SetParam;
最佳答案
property Param
是TParam
。因此,SetParam
需要将Index
接收到数组中,然后将TParam
放入数组中。您的setter会提供索引和两个字符串,都不是TParam
。
合适的二传手是
procedure SetParam(Index: Byte; const Value: TParam);
关于class - Delphi : Error 2008 Incompatible types for a class property,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21369445/
我是一名优秀的程序员,十分优秀!