Creating array of objects - No default constructor (needs initializer list)
This is a question regarding creating array of objects using new.
This class doesnt have default constructor, i.e., should provide a initializer list.
Ex.
Class CTest
{
private:
int m_nIndex;
long m_lLongIndex;
public:
CTest(int nIndex, long lLongIndex); //No default constructor
}
CTest:: CTest(int nIndex, long lLongIndex): m_nIndex(nIndex), m_lLongIndex(lLongIndex)
{
}
void main(void)
{
CTest* ptrTest = new CTest[5] ??????????
// How to do this?
}
Thanks and Regards
Kannan S CTest* ptrTest = new CTest[5] ??????????