Saturday, 14 September 2013

Error with template class constructor taking arguments

Error with template class constructor taking arguments

I've been looking around the internet for a solution to my problem, but
haven't found an example question quite like mine (that I recognize).
I'm trying to create a simple constructor for my template class, but there
must be something wrong with my syntax or my implementation because I keep
getting the same compilation error when I test it out. It seems to have
something to do with the way I am passing arguments because if I create an
object with no arguments it compiles fine (which seems odd because I have
no constructor that does not take arguments).
vecxd.hpp:
#ifndef JF_VecXd
#define JF_VecXd
template <class T>
class VecXd : public VecXd<T>{
public:
VecXd(T a, T b, T c);
private:
T x, y, z;
};
template <class T>
VecXd<T>::VecXd(T a, T b, T c){
x = a;
y = b;
z = c;
}

No comments:

Post a Comment