See more: MFC Hi,
In my Dialog based MFC application, I have the below error w.r.t Constructor, even though multiple changes made in order, and types of params, the error w.r.t constructor still exists,
CDlgMac : public CDialog
{
public:
CDlgMac (CMac*,CWrkShp*,CPtrList& ,CJoe&,CWnd* pParent = NULL);
Seems this is typical handling for constructors, I think I am missing some where in member initialization lists.Two new data members get added here below
CJoe& m_Opt;
CPtrList& m_Obj;
After above inclusion, the same constructor definition are as under,
In Dialog.cpp
//Earlier Existing Constructor definition w.r.t Dialog.h file,(signature 1)
CDlgMac ::CDlgMac (CMac* pMac,CWrkshp* pWkshp,CWnd* pParent )
: CDialog(CDlgMac ::IDD, pParent), m_pMac(pMac),m_pWorkShop(pWrkShp)
{
}
modified constructor definition as below,
CDlgMac::CDlgMac(CMac* pMac,CWrkShp* pWrkShp,CPtrList& ObjectLst,CJoe& OptPage2 ,CWnd* pParent )
: CDialog(CDlgMac::IDD, pParent), m_pMac(pMac),m_pWrkShp(pWrkShp),m_Obj(ObjectLst),m_Opt(OptPage2)
{
}....
....
In OtherFile Job.cpp
I invoke the following code,
...
...
CDlgMac dlg(pMac,m_pParent->GetWork(),NULL); ----> Error shown in this line
On build, I get the following errors,
1>error C2664: 'CDlgMac::CDlgMac(CMac *,CWrkShp *,CPtrList &,CJoe &,CWnd *)' : cannot convert parameter 3 from 'int' to 'CPtrList &'
OR
2>d:\v-olp\Job.cpp(1906) : error C2668: 'CDlgMac::CDlgMac' : ambiguous call to overloaded function
Basically, my target is to initialize all the variables/data members using member initialization lists, using pointer and class(reference).
Any help in resolving the above would be much appreciable.,
I am using MFC 9.0v. using VS2008 Feature pack.
With Regards,
VishalK