[fpc-pascal] Heterogenous list of objects

Michael Van Canneyt michael at freepascal.org
Tue Jan 22 12:07:56 CET 2008



On Tue, 22 Jan 2008, g.marcou at chimie.u-strasbg.fr wrote:

> Hi,
> 
> I'd like to manage a list of heterogenous objects. For instance, I have a list
> of objects to buy in store: cheeses (of class TCheese), soaps (of class
> TSoap), flowers (of class TFlower), etc...
> 
> I thought to gather pointers to different objects of these classes in a TList.
> But, when it comes to manipulate or destroy these items, I am in trouble: I
> have lost the information about the precise type of the object the pointer
> points to.
> 
> Does somebody have an idea?

Use TObjectlist from contnrs.pas

Michael.



More information about the fpc-pascal mailing list