In C++, I have a class CMyObject as follows, where CData is another class name:
Class CMyObject
{
CMyObject(CData& Data): m_Data(Data) {};
virtual ~CMyObject(void);
private:
const CData& m_Data;
}
When allocate one CMyObject instance, I can do as follows:
P = new CMyObject(MyData);
However, if I want to create an array of CMyObject, then can I do as follows?
P = new CMyObject(MyData)[10];