出于兼容性原因(对象被序列化并导出并且必须与外部名称匹配)我希望字段名称为’type’,即
- TTBaseWebResponse = class
- private
- type: String;
- success: Integer;
- end;
- or
- TTBaseWebResponse = class
- private
- ftype: String;
- fsuccess: Integer;
- public
- type: string read fstring write fstring;
- success: integer read fsuccess write fsuccess;
- end;
Delphi(XE2)甚至不会编译它.
这是可能吗?怎么样?
解决方法
尝试使用&在字段名称之前