|
-
June 18th, 2008, 01:55 AM
#1
Doubt, What its Meaning?
Class CMyObject
{
public:
CMyObject();
~CMyObject();
};
CMyObject *pMyObject;
pMyObject = new CMyObject[10]; // What is its meaning
Rajeev
Thanks
-
June 18th, 2008, 01:58 AM
#2
Re: Doubt, What its Meaning?
An array of 10 CMyObject objects.
-
June 18th, 2008, 02:00 AM
#3
Re: Doubt, What its Meaning?
 Originally Posted by RajeevR
Class CMyObject
{
public:
CMyObject();
~CMyObject();
};
CMyObject *pMyObject;
pMyObject = new CMyObject[10]; // What is its meaning
Rajeev
Thanks
Well it means a dynamic array of size 10 of CmyObject class.
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();
Dont forget to rate my post if you find it useful.
-
June 18th, 2008, 02:05 AM
#4
Re: Doubt, What its Meaning?
-
June 18th, 2008, 03:51 AM
#5
Re: Doubt, What its Meaning?
it also means, when you are done using it, destroy it
delete always goes hand in hand with new
Code:
delete[] pMyObject;
Last edited by ChessMaster; June 18th, 2008 at 03:57 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|