Delphi RAD Studio类完成问题

时间:2016-09-06 10:51:16

标签: delphi delphi-xe6

如果我有以下类结构,我无法使用Embarcadero RAD Studio XE6调用类完成(通过Ctrl + Shift + C)。程序运行正常,但IDE导致以下错误。如果我想使用它,我必须评论DescriptionArray,这有点烦人。

因此,我想知道,如果有人知道,问题出在哪里,或者我做错了什么。

GT_Class = class
type
  TCustomEnum = (ceValue1, ceValue2, ceValue3, ceValue4);
  TCustomSet = set of TCustomEnum;

const
  DescriptionArray : array[TCustomEnum] of string = ('Description1', 'Description2', 'Description3', 'Description4');
end;

错误消息

Error message

1 个答案:

答案 0 :(得分:0)

Stefan Glienkecomment解决。实际上它是Delphi XE6中的一个错误,在其他版本中它已被解决。在这种情况下,您需要定义可见性public,即使不应该这样做。

GT_Class = class
public
  type
    TCustomEnum = (ceValue1, ceValue2, ceValue3, ceValue4);
    TCustomSet = set of TCustomEnum;

  const
    DescriptionArray : array[TCustomEnum] of string = ('Description1', 'Description2', 'Description3', 'Description4');
end;