468,513 Members | 1,763 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,513 developers. It's quick & easy.

Dynamic allocation for Objects

Hi All, My slef Prashanth just learning c++, and VC++, i need all you help.

We use New operator to dynamicly allocate the memory for a variable.
Dynamic allocation is used to optimize the memory allocation for a variable.
(say in case of the arrays.)

In case of Objects, the size if determined by the data members of the class.
On using New operator how is it that we can optimize the memory allocation.
could any one Please help me with this question.
Sep 3 '06 #1
2 3939
Banfa
9,056 Expert Mod 8TB
Optomise in what way?

For any class A then

A *pA =new A;

Will allocate the correct amount of data to hold the class variables.
Sep 3 '06 #2
Then what is the difference between the
Object instantiation(normal obj creation).
and Object creation using NEW operator in terms of memory allocation for the object.?

What are the scenario in which we need to use object creation using NEW operator.
Sep 6 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

9 posts views Thread by Tom | last post: by
13 posts views Thread by xian_hong2046 | last post: by
11 posts views Thread by toton | last post: by
14 posts views Thread by vivek | last post: by
5 posts views Thread by mike.m.schmidt | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.