Hi Guys, I am trying to teach myself templates and I keep getting lost in all these compilation errors. Here is the latest
// This is the interface for the base class
template<class V, class I =int>
class Array{
private:
vector<V> myStore;
public:
Array();
Array(I size);
Array(I size, V value);
~Array();
int size();
const V& element(I index);
V& operator[] (I index);
void print();
};
// This is the interface for the derived class
template<class V, class I=int>
class NumericArray: public Array<V,I>{
public:
NumericArray();
NumericArray(I size){}
NumericArray(int size, double value){}
~NumericArray(){}
// void print();
};
This is my implementation for the constructor
template<class V, class I> NumericArray<V,I>::NumericArray(I size):Array<V,I>(size){
}
But this keeps giving me a compiler error. undefined reference to `Array<double, int>::Array(int)'.
What am I doing wrong here? Any help would be much appreciated.