Class CMyObject
{
public:
CMyObject();
~CMyObject();
};
CMyObject *pMyObject;
pMyObject = new CMyObject[10]; // What is its meaning
Rajeev
Thanks
Printable View
Class CMyObject
{
public:
CMyObject();
~CMyObject();
};
CMyObject *pMyObject;
pMyObject = new CMyObject[10]; // What is its meaning
Rajeev
Thanks
An array of 10 CMyObject objects.
Well it means a dynamic array of size 10 of CmyObject class.Quote:
Originally Posted by RajeevR
The object it holds are default initialized that means using default constructor.
pMyObject is the pointer to the first element of the array.
and follwing operation is perfectly fine..
pMyObject[4].CallMethod();
Thank you very much.
it also means, when you are done using it, destroy it
delete always goes hand in hand with new
Code:delete[] pMyObject;