I have a class Scalable
:
template<typename T, int size>
class Scalable {
// implementation
protected:
std::array<T, size> data;
}
and a derived class Color
:
struct Color : Scalable<double, 3> {
// implementation
}
When I try to do something like
Scalable<double, 3> s;
Color c(s);
I get
No matching constructor for initialization of 'Color'
I have not defined any of the functions in the rule of 5, but I thought since Color
is a Scalable
it could use the implicitly defined copy constructor.
Does this mean for every subclass I have to define the constructor
Subclass(const Scalable<T, n> & o)
even though there are no extra fields?
I also tried adding using Scalable<double, 3>::Scalable;
but that didn't work.