Yes you are right... Only 8 bytes will be..
Code:
#include<iostream.h>
#include<malloc.h>
class A
{
private:
int *i;
char *c;
public:
A()
{
i = new int[50];
c = new char[100];
}
};
int main()
{
A obj;
cout<<sizeof(A)<<endl<<sizeof(obj)<<endl;
return 0;
}
First you have to understand how's sizeof operator works. Actulllay it works at the time of compile time. So it calculates sizes available on compile time ..So it will give 8 bytes on 32-bit machine. As i think you understood.