I want to create an array of objects and I want to use a certain constructor.
std::vector<Modul> arrDigOut;
arrDigOut.push_back(Modul(IDC_CHECK1, this, "GVL.DigOut1", pAddr));
This works as long as DigOut
is not a derived class. When I derive it and use the class DigOut
it fails:
class Modul
{
protected:
int id;
int nErr;
void* plcVar;
bool bDigOut;
PAmsAddr pAddr;
ULONG lHdlVar;
CButton* pBt;
public:
Modul();
//Modul(int ID, Cbeckhoff_frontendDlg* pCbeckhoff,void* pVar,PAmsAddr pAdr)
//{
// SetID(ID,pCbeckhoff);
// plcVar = pVar;
// pAddr = pAdr;
//};
int GetID() { return (id); };
void* GetplcVar() { return plcVar; };
void SetID(int ID, Cbeckhoff_frontendDlg* pCbeckhoff);
int InitCheck(Cbeckhoff_frontendDlg* pCbeckhoff);
CButton* GetpBt(){return pBt;};
void SetButton( Cbeckhoff_frontendDlg* pCbeckhoff);
};
class DigOut : protected Modul
{
public:
DigOut();
DigOut(int ID, Cbeckhoff_frontendDlg* pCbeckhoff,void* pVar,PAmsAddr pAdr)
{
SetID(ID,pCbeckhoff);
plcVar = pVar;
pAddr = pAdr;
};
};