I''d changed second structure, adding inheritance etc...
This is results:
sizeof(struct1)==2
sizeof(struct2)==8 // !!!
0x0012FED4 01 02 // struct1
0x0012FEC4 c8 40 42 00 03 04 // struct2
Before member data in struct2, i see 4 bytes of ''garbage''...
So, you been right after all
![](smile.gif)
Anyway, i didn''t like the idea of saving(sending) entire struct(class) like that from the start
![](wink.gif)
To all:
BTW: Reading this thread was lot of fun! Thanks a lot, guys!!!
//==============================
struct struct1
{
unsigned char m1;
unsigned char m2;
};
//==============================
struct base_struct2
{
protected:
unsigned char n1;
unsigned char n2;
base_struct2() {n1=3; n2=4;}
};
struct struct2: public base_struct2
{
protected:
virtual void Clean() {n1=0; n2=0;}
public:
struct2(): base_struct2() {}
virtual ~struct2() {Clean();}
};
Not registered: Fei