Original Post
I''m having trouble with template classes under MSVC++. I seem to have to declare and define all the member functions of the class in the header file if I''m going to use templates. Is there something I''m doing wrong?
And another thing. A template class that compiles fine on MSVC++ doesn''t compile at all on g++. Is there some specific switch that I must use or does g++ not support templates well (I remember reading somewhere...).
template <class T>
class A
{
protected:
T *data;
public:
A() : data(NULL){/*Do nothing*/}
virtual ~A(){}
void setData(T *newData);//I have to define this in the class
//definition and I can''t do this in a
//.cpp file.
};
|