hey guys, i dont know where to put this.i have looked in the gnu gcc compiler site and i went lost.
i have an issue, where i cant seem to compie a very simple tempate class. im using gcc 3.4.5 with mingw.
here is my class:
#ifndef TEST_H
#define TEST_H
template <class T>
class test
{
// variable
T *_linkedList;
unsigned int _count;
unsigned int _capacity;
public:
test()
{
_linkedList = new T[10];
memset(_linkedList, 0, 10);
_count = 0;
_capacity = 10;
}
virtual ~test()
{
}
unsigned int GetCount()
{
return _count;
}
T Get(int index)
{
if( index >= 0 && index <= _count )
return _linkedList[index];
else
return _linkedList[_count-1];
}
void Add(T object)
{
if( _count+1 <= _capacity-5 )
_linkedList[_count++] = object;
}
protected:
private:
};
#endif // TEST_H
and when i come to use it:
test<int> t = test<int>();
t.Add(0);
t.Add(1);
t.Add(2);
int i = t.Get(1);
i get the "ïnstantiated from here" compile error on line "int i = t.Get(1);". I cant see where i am going wrong.
sorry is this is in the wrong place, but i dont know where to podt it.
thxxx