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

前端之家收集整理的这篇文章主要介绍了delphi – 是否可以将保留字用于字段名称?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
出于兼容性原因(对象被序列化并导出并且必须与外部名称匹配)我希望字段名称为’type’,即
  1. TTBaseWebResponse = class
  2. private
  3. type: String;
  4. success: Integer;
  5. end;
  6.  
  7. or
  8.  
  9. TTBaseWebResponse = class
  10. private
  11. ftype: String;
  12. fsuccess: Integer;
  13. public
  14. type: string read fstring write fstring;
  15. success: integer read fsuccess write fsuccess;
  16. end;

Delphi(XE2)甚至不会编译它.
这是可能吗?怎么样?

解决方法

尝试使用&在字段名称之前

猜你在找的Delphi相关文章