You may have other problems as well, but one thing has got to be your use of super
. That's a java thing not a C++ thing. Instead of super
you need to use CDialog
.
After looking into IMPLEMENT_DYNAMIC
the macro definition is not compatible with templates, it doesn't use the template <class T>
syntax before the function definitions. What you need to do is define derived class specializations of your template and then use the macro on them. So you could do this:
class MyDlgA : public CMyDlg<A>
{
};
IMPLEMENT_DYNAMIC(MyDlgA, CDialog);
And then do that for all specializations that you want. If that's not feasible, look at the macro and make your own templatized version of it.
Edit:
Following up on my comment, you could make a macro like this:
#define INSTANTIATE_DLG_TEMPLATE(T)
class MyDlg##T : public CMyDlg<T>
{
};
IMPLEMENT_DYNAMIC(MyDlg##T, CDialog);
And then just use this wherever you would normally have defined the template specialization in a header file with a typedef.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…