Hi,
class Sample
{
int x, *ptr;
public:
Sample()
{
ptr = new int[100];
}
~Sample()
{
}
};
int main()
{
cout << "SizeofClass" << sizeof(Sample); //gives me output 8
Sample sm;
cout<< "SizeofObject" << sizeof(sm); //also gives me output 8


}

But i assume the size of sample object should be 4(x) + 400(ptr) = 404 bytes

Is there anyway that i can know or print the total memory alloacted which

x + ptr = 4 +400 = 404 bytes

Is my assumption correct ? Pls clarify me on this

Thanks
Kiran