hello, quick question regarding template classes and pointers. I'm making a linked list kind of container system, and I'm running into trouble with it when I (don't know if the terminology is 100% correct here) declare an instance of it. An example would be best to explain what's happening:
I tried the following just to see if it would work ok, on one I get linker issues, on the other, it's fine.
Link<int> test1; //linker error
Link<int> test2(); //compiles fine
Link<int> *test3 = new Link<int>(); //linker error
delete *test3;
Is there something special I need to do to a class to make it able to be a pointer? The rest of the data structure follows, it's quite bare at this point. Thanks!
~J
//link.cpp
#include "link.h"
template <class T>
Link<T>::Link()
{
size = -1;
nextLink = NULL;
}
//link.h
template <class T>
class Link
{
private:
Link<T> *nextLink;
int size;
public:
Link();
};