My class needs to call the constructor of his parent class. But I am having issues with that, due to the fact that they are template classes.
The code of my derived class is given below:
template <class CTHIS, typename T>
class genericalMethodClassWithSeveralInternalParametersClass:public genericalMethodClassWithInternalParameterClass<CTHIS, myNUpleType<T>>
{
protected:
float (CTHIS::*funcVersionWith2Parameters)(float, myNUpleType<T>) const;
public:
genericalMethodClassWithSeveralInternalParametersClass(float (CTHIS::*_funcVersionWith2Parameters)(float, myNUpleType<T>) const, const CTHIS *_thisPar, myNUpleType<T> _fixedParam)
{
funcVersionWith2Parameters = _funcVersionWith2Parameters;
genericalMethodClassWithInternalParameterClass<CTHIS, myNUpleType<T>>::genericalMethodClassWithInternalParameterClass<CTHIS, myNUpleType<T>>(funcVersionWith2Parameters, _thisPar, _fixedParam); // compiler doesn't accept this line
}
};
The second line of the constructor is supposed to call the constructor of the parent class, but the compiler doesn't accept it. What should I put in there instead?
EDITED: I've simply added the constructor in the initializer list and it worked:
template <class CTHIS, typename T>
class genericalMethodClassWithSeveralInternalParametersClass:public genericalMethodClassWithInternalParameterClass<CTHIS, myNUpleType<T>>
{
protected:
float (CTHIS::*funcVersionWith2Parameters)(float, myNUpleType<T>) const;
public:
genericalMethodClassWithSeveralInternalParametersClass(float (CTHIS::*_funcVersionWith2Parameters)(float, myNUpleType<T>) const, const CTHIS *_thisPar, myNUpleType<T> _fixedParam):genericalMethodClassWithInternalParameterClass<CTHIS, myNUpleType<T>>(_funcVersionWith2Parameters, _thisPar, _fixedParam)
{
funcVersionWith2Parameters = _funcVersionWith2Parameters;
}
};
Still, for the future, I would like to know how could I call the constructor of the parent inside of the derived class code. Actually, thinking for a while, this syntax issue would probably appear at any call for method of a parent class (not just the constructor).