> -----Original Message-----
> Also, when I create my TCollection object, I pass the TCollectionItem
> class I wish to use, is it possible to have different Item
> classes in one
> collection?  I was thinking of something like:

No, not without modification to the TCollection class.  However, you can
easily imitate this behaviour by making your TCollectionItem class a
container.

TSomeClass = class;

TMyCollectionItem = class (TCollectionItem)
private
  ContainedObject: TSomeClass;
end;

ContainedObject can hold any instance of classes that derive from
TSomeClass.  You will need to control the lifetime of ContainedObject in
TMyCollectionItem class.


Regards,
Dennis.

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to