I think the error message is obvious:
CFormView
doesn't have a default constructor and because of this the automatically generated constructor of your
COfficeBorder<CFormView>
class has nothing to call. By the way, why
COfficeBorder<CFormView>
and not
COfficeBorder<CTest3View>
?
EDIT: Example code for template specialization:
class ControlBase
{
protected:
virtual void DoSomething() {}
};
class Control1 : public ControlBase
{
public:
Control1() {}
};
class Control2 : public ControlBase
{
public:
Control2(int param) {}
};
class CommonHelpers
{
public:
static void DoSomething(ControlBase* b)
{
}
};
template <typename BaseControl>
class ControlBorder : public BaseControl
{
protected:
virtual void DoSomething() override
{
CommonHelpers::DoSomething(this);
}
};
template <>
class ControlBorder<Control2> : public Control2
{
public:
ControlBorder()
: Control2(2)
{}
protected:
virtual void DoSomething() override
{
CommonHelpers::DoSomething(this);
}
};