Hi all,

thanks for your kind and fast answer. Effectively, TObjectList is what I need. Thanks to Damien, I understand a bit better how it works. But in my case I believe that I need to use some kind of TList of TObjectList. So is it possible to build a class that will have TObjecList member so that I will be able to use TList of this class?

For instance:

-----
TToDo=class(TList)
private
  fProducts: TObjectList;//Cheeses, Soaps, etc.
  fShops: TObjectList;//Shops, Markets, Internet,...
public
  property Products: TObjectList read fProducts write fProducts;
  property fShops: TObjectList read fShops write fShops;
  creator Create;
  destructor Destroy; override;
  procedure Clear; override;
  ...
end;
-----

I may have to say more about my project so you'll have better insight in my design problem. I have an XML to drive my application to do a set of diverse actions.

Root
|
|-action1-|-action11
|         |-action12
|
|-action2-|-action21
          |-action22

action1 and action2 shall be a TObjectList because action11, action12,... can be instances of different classes. Then I want action1 and action2 to be stored in some kind of container (I believe a TList).

So I call to your opinion to see if it is an acceptable design and if I am not mixing incompatible concepts (TList and TObjectList).

Thanks for your insight,
Gilles Marcou




_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to