As far as I know, class and struct data is placed one variable after another, for example:
class Foo
{
int A;
char B;
float* C;
double* D;
};
Foo Object;
char* ptr = &Object;
&(Object.A) == ptr; // all these are true
&(Object.B) == ptr+sizeof(int);
&(Object.C) == ptr+sizeof(int)+sizeof(char);
&(Object.D) == ptr+sizeof(int)+sizeof(char)+sizeof(float*);
Does it always work that way? Would it also work if I made all these data static in the class?