Hi,
Lat us take a class like
Code:
class A
{
   int *i;
   char *c;

   A()
   {
       i = (int*) malloc( 50 * sizeof(int));
       c = (char*) malloc(100);
   }
};
If we created an object for this class then the size of that object will be 8 bytes...

My question is how to know how much memory is the object actually dealing with..
i mean in this case
2pointrs = 8 bytes
memory allocated for i = 50 * 4 = 200 bytes
for c = 100 bytes
In total 308 bytes..

Is there any function we can use to get this 308 as the answer...
If we are creating some other objects in this class, then that memory also has to include..

Last edited by shabbir; 17Jan2009 at 20:11.. Reason: Code blocks