Do these two structures have the same memory layout? (C ++)
struct A
{
int x;
char y;
double z;
};
struct B
{
A a;
};
Next, can I access the elements x, y, z if I manually transfer the object of this object to A?
struct C
{
A a;
int b;
};
Thanks in advance.
EDIT:
What if they were classesinstead structs?
source
share