我的类的定义如下:
  TMyClass_New = class(TObject)
  private
    { Private declarations }
    function GetItems (Index: integer): TMyClass;
    procedure SetItems(Index: integer; const Value: TMyClass);
  protected
    { Protected declarations }
  public
    { Public declarations }
  published
    { Published declarations }
  property Items[Index: integer]:TMyClass read GetItems write SetItems;
  end;报错:
"Published property 'Items' cannot be of type ARRAY".但delphi的TList中的Items属性就是这么定义的.我的为什么不行?

解决方案 »

  1.   

    你写到PUBLIC里去吧,不能在PUBLISHED里写的;
      

  2.   

    噢!是,TList就是在public中定义的.
    再请问兄台一句,public和published有什么区别?
      

  3.   

    从TObjectList继承呢,改成
    TMyClass_New = class(TObjectList)
    你试试!
      

  4.   

    Public表示是公共属性的。
    Published 表示是公开的,当你把这个类做成组件的时候,在Published中定义的属性会出现在
    Delphi的属性窗口中。