S
sgrm123
Guest
Hi,
I want to have class template parameter for MFC Dialog derived class.
template <class T>
class CMyDlg : public CDialog
{
DECLARE_DYNAMIC(CMyDlg <T>)
public:
CMyDlg (CWnd* pParent); // standard constructor
virtual ~CMyDlg ();
// Dialog Data
enum { IDD = IDD_MYDLG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
public:
T *m_pWnd;
};
IMPLEMENT_DYNAMIC(CMyDlg<T>, CDialog)
template <class T>
CMyDlg<T>::CMyDlg(CWnd* pParent)
: CDialog(CMyDlg::IDD, pParent)
{
}
template <class T>
void CMyDlg<T>:oDataExchange(CDataExchange* pDX)
{
CDialog:oDataExchange(pDX);
}
template <class T>
BEGIN_MESSAGE_MAP(CMyDlg<T>, CDialog)
END_MESSAGE_MAP()
But I am getting bunch of errors but one of the main error is error C2955: 'MyDlg' : use of class template requires template argument list"" please help me to resolve the errors
Continue reading...
I want to have class template parameter for MFC Dialog derived class.
template <class T>
class CMyDlg : public CDialog
{
DECLARE_DYNAMIC(CMyDlg <T>)
public:
CMyDlg (CWnd* pParent); // standard constructor
virtual ~CMyDlg ();
// Dialog Data
enum { IDD = IDD_MYDLG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
public:
T *m_pWnd;
};
IMPLEMENT_DYNAMIC(CMyDlg<T>, CDialog)
template <class T>
CMyDlg<T>::CMyDlg(CWnd* pParent)
: CDialog(CMyDlg::IDD, pParent)
{
}
template <class T>
void CMyDlg<T>:oDataExchange(CDataExchange* pDX)
{
CDialog:oDataExchange(pDX);
}
template <class T>
BEGIN_MESSAGE_MAP(CMyDlg<T>, CDialog)
END_MESSAGE_MAP()
But I am getting bunch of errors but one of the main error is error C2955: 'MyDlg' : use of class template requires template argument list"" please help me to resolve the errors
Continue reading...