I have a situation where the wrong constructor is being called. I
have defined 2 constructors with different parameter types that are
defined as follows...
class __declspec(dlle xport)CColumn : public CColumnBase
{
public:
CColumn(CString columnType,CObj ect *aOwner, CString anId);
CColumn(CString columnType,CObj ect *aOwner, bool batchUpdated);
....
}
The implementation of these functions looks like this...
CColumn::CColum n(CString columnType, CObject *aOwner, CString anId)
{
setColumnType(c olumnType);
setOwner(aOwner );
setId(anId);
setLength(10);
setPrecision(5) ;
setField();
setBatchUpdated (false);
}
CColumn::CColum n(CString columnType, CObject *aOwner, bool
batchUpdated)
{
setColumnType(c olumnType);
setOwner(aOwner );
setId("");
setLength(10);
setPrecision(5) ;
setField();
setBatchUpdated (batchUpdated);
}
When the line below in the CDual() constructor gets called, the
constructor with the signature of CColumn::CColum n(CString columnType,
CObject *aOwner, bool batchUpdated) gets invoked, rather than the one
I want.
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
IMPLEMENT_DYNCR EATE( CDual, CDomain )
CDual::CDual()
{
...
addColumn(new CColumn(TIMESTA MP_COLUMN,this, "TIMESTAMP" ));
...
}
Does anyone have any idea why this is happening and how to avoid this
issue?
Thanks,
Joe
have defined 2 constructors with different parameter types that are
defined as follows...
class __declspec(dlle xport)CColumn : public CColumnBase
{
public:
CColumn(CString columnType,CObj ect *aOwner, CString anId);
CColumn(CString columnType,CObj ect *aOwner, bool batchUpdated);
....
}
The implementation of these functions looks like this...
CColumn::CColum n(CString columnType, CObject *aOwner, CString anId)
{
setColumnType(c olumnType);
setOwner(aOwner );
setId(anId);
setLength(10);
setPrecision(5) ;
setField();
setBatchUpdated (false);
}
CColumn::CColum n(CString columnType, CObject *aOwner, bool
batchUpdated)
{
setColumnType(c olumnType);
setOwner(aOwner );
setId("");
setLength(10);
setPrecision(5) ;
setField();
setBatchUpdated (batchUpdated);
}
When the line below in the CDual() constructor gets called, the
constructor with the signature of CColumn::CColum n(CString columnType,
CObject *aOwner, bool batchUpdated) gets invoked, rather than the one
I want.
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
IMPLEMENT_DYNCR EATE( CDual, CDomain )
CDual::CDual()
{
...
addColumn(new CColumn(TIMESTA MP_COLUMN,this, "TIMESTAMP" ));
...
}
Does anyone have any idea why this is happening and how to avoid this
issue?
Thanks,
Joe
Comment