This question already has an answer here:
A.h:
template<typename T>
class A{
public:
A(int n);
int a;
};
A.cpp:
#include "header.h"
template <typename T>
A<T>::A(int n){
this->a = n;
}
main:
int main ()
{
A<int> m(5);
return 0;
};
and i got err undefined reference to `A::A(int)',code seems correct to me, any idea why this happen? thx a lot.
Aucun commentaire:
Enregistrer un commentaire