Christian Christmann wrote:[color=blue]
> Hi,
>
> I need a template list where I can store pointers to
> different objects. The list consists of linked objects
> of the class Element which contain the pointer information.
>
> How do I define the template class Element in the header file?
>
> template <class T> class Element
> {
> T* info;
> ...
> }
>
> or
> template <class T*> class Element
> {
> T* info;
> ...
> }
>
> And let's say I want to store pointers to an object Node.
> What is the right initialization in the source code:
>
> ...
> Node *newNode;
> Element<Node> = new Element<Node>
>
> or
>
> Node *newNode;
> Element<Node*> = new Element<Node*> ?
>
>
> Thanks
> Chris[/color]
Check out the code examples for a Heterogeneous Container in the
following links:
http://code.axter.com/HeterogeneousContainer.cpp http://code.axter.com/HeterogeneousContainer_2.cpp
The above Heterogeneous Container can hold any type, as long as all the
types have some function or inteface in common.