471,084 Members | 828 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,084 software developers and data experts.

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 4021
9,065 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

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.