How to write constructor for class that base class name is from template? as I try to compile code below then i get this error
undefined reference to >
IMU<ADXL>::IMU(int)
In function `_GLOBAL__sub_I_rdy'
>>>main.cpp<<<
IMU<ADXL335> obj(8);
>>>IMU.h<<<
template <class T>
class IMU : public T
{
public:
const int someMember=0;
IMU(int);
};
>>>IMU.cpp<<<
template <class T>
IMU<T>::IMU(int x) // IMU constructor
: T() // base constructor
, someMember(x)
{
}
it should work as
>>>main.cpp<<<
IMU obj(8);
>>>IMU.h<<<
class IMU : public ADXL
{
public:
const int someMember=0;
IMU(int);
};
>>>IMU.cpp<<<
IMU::IMU(int x) // IMU constructor
: ADXL() // ADXL constructor
, someMember(x)
{
}