single linked list with data portion as different types

Hi,

In one of my assignment, I want to write a single linked list in which data portion is of diffrent types.
eg:
one node as int, other node as char, other node should be user defined struct and 4th should be user defined object.


how to achive this????

There are a variety of ways to do this. One way is using void pointers. I'll leave it up to you to find other, safer ways.
You have a homework assignment to write a heterogeneous container? Are you sure the assignment doesn't mean to use templates and each instantiation of the list type can hold a collection of one of those types?
Topic archived. No new replies allowed.