以下S和F的声明有什么区别?
type TMyClass = class(TObject) private S: String; private var F: String; end;
我问的原因是因为我可以像F一样使用S(不添加var关键字).
他们是否受到不同待遇?
解决方法
没有任何区别.根据
the documentation:
The var keyword is optional. However,if it is not used,then all field declarations must occur before any property or method declarations. After any property or method declarations,the var may be used to introduce any additional field declarations.