I have a problem with the derivation of template classes. The following code-snippet will show my problem:
class object {
}
template <class T>
class container {
public:
cotainer(void) {
// do some work
}
}
template <class in, class out>
class stage {
private:
container<in> *input;
container<out> *output;
public:
stage(bool input, container<out> *output) {
// do some other work
}
}
After that, I want to derive from stage. I get no error, if the derived class is also a template class like:
template <class T>
class derived : public stage<T, T> {
public:
derived(container<T> *output) : stage<T, T>(false, output) {}
}
But, if the derived class is a specialization of stage, I get an error.
class derived : public stage<object, object> {
public:
derived(container<object> *output) : stage<object, object>(false, output) {}
}
The error is, that the compiler does not find the constructor of stage.
undefined reference to `stage<object, object>::stage(bool, container<object>*)'
How can I solve the problem?