Hi All, first of all, thanks for all you do, you guys do great work!
I'm trying to make a template class and make it dynamic... I'll explain it better w/ the code:
template <class Data>
That's just a node to a linked list. Now, here's my main function:
node<int> *hp = new node<int>;
Now for the question... I know this syntax is wrong and won't work:
node *hp = new node<int>;
but, is there a way to make that work? Basically what I'm asking is how to create a pointer to a template class, but then dynamically change what type of template class it is.
Here's a class example where I would want this to work:
void addNode(int mi_dType);
void llist::addNode(int mi_dType)
if (mi_dType == 1)
hp = new node<int>;
hp = new node<string>;