Reputation: 520
hi i am stuck tryng to use a class declaring as template class, thus my knowledge of templates is basic.
//this is my code
#include "templateClassImp.cpp"
clase aClass{
public:
aClass();//implementing in cpp file
private:
ATemplateClass<class EMode, char> mMenberVariable;/*<< Doenst like this!!!! error compiling*/
}
//--------------------------
//templateClassImp.cpp
template<class Emode, class element = char>
class templateClassImp{}
//what i want to achieve is to use that class inside my non template class.
Upvotes: 0
Views: 2141
Reputation: 227370
You have to either make aClass
a class template, or provide template parameters for mMenberVariable
.
template <class T1, class T2=char>
class aClass
{
public:
aClass();
private:
ATemplateClass<T1, T2> mMenberVariable;
};
or
class aClass
{
public:
aClass();
private:
ATemplateClass<int, double> mMenberVariable;
};
Upvotes: 6
Reputation: 10719
you have to parameterize all template parameters in a template definition to use it.
ATemplateClass<EMode, char> mMenberVariable
Upvotes: -1