I'm having a hard time understanding template class implementation in C++. I understand what a template class is and how to use it, but I cannot seem to implement them properly. This is for school so I cannot use standard library list/etc. I have made a template List class that acts as a linked list using a template node class. I have a third class bigInt which will be used to do infinite precision addition, multiplication, etc. For the bigInt class I get an error when trying to have a variable "values" that is of type List. Why is this? Error: "Error C2079 'bigInt::values' uses undefined class 'List'"
bigInt.h looks like:
template <typename T>
class List;
class bigInt {
public:
List<int> values;
bigInt();
bigInt add(bigInt);
bigInt mul(bigInt);
bigInt pow(int);
};
I added the first two lines because I read somewhere that I needed to use "forward declaration" (since you apparently cannot use an #include "List.h") which I also don't really understand.
Any help would be really appreciated.