|
-
December 12th, 2011, 08:44 AM
#8
Re: Array of objects - member variable in free store error
I understand the error no. 1, 2 and 4.
But error no. 3 is somewhat confusing to me.
I have some questions
1)
Why array elements Executive[0] and Executive[1] are destroyed as soon as they are created. I have learned that objects gets
destroyed when goes out of scope or memory which is allocated in free store, need to be free .
2)
I have dynamically allocated only array elements Executive[0] and Executive[1] in free store, not Executive[]. So my
assumption is, only Executive[0] and Executive[1] should call destructor not the Executive[].
If you think I should do some homework before asking stupid questions like this then please suggest me any resources on web.
Or if you correct the code I might understand something.
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
|