delphi 组件容器TObjectList代替List

 TObjectList

objList->delete(0);

这个会释放第0行元素的对象

    class TTabFormInfo
    {
    public:
           int a;
        String s1;
        String s2;
        TForm *frm;
    };

如果是这样的对象,删除的时候frm指针所指的对象也要删除,frm指针为空就不删除,不为NULL就删除。

所以不想删除frm指针的对象,就不用TObjectList。

 

但是如果仅仅是简单类型或frm是自己new的,TObjectList用起来会很方便。

 

 

参考

http://www.cnblogs.com/del/archive/2011/12/21/2295794.html

相关文章:

  • 2021-11-17
  • 2021-11-13
  • 2022-12-23
  • 2021-12-15
  • 2022-12-23
  • 2021-10-16
  • 2021-05-28
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-03
  • 2022-12-23
  • 2021-09-15
  • 2021-06-12
相关资源
相似解决方案