delphi – 是否可以将保留字用于字段名称?

前端之家收集整理的这篇文章主要介绍了delphi – 是否可以将保留字用于字段名称?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
出于兼容性原因(对象被序列化并导出并且必须与外部名称匹配)我希望字段名称为’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)甚至不会编译它.
这是可能吗?怎么样?

解决方法

尝试使用&在字段名称之前
原文链接:https://www.f2er.com/delphi/102453.html

猜你在找的Delphi相关文章