I have 2 classes which are,

```
#define    HEADER_SIZE    sizeof(CHeader)
#define    BODY_SIZE      5132  
#define    PACKET_SIZE    sizeof(CPacket)  

Class CHeader
{
    BYTE    a;
    BYTE    b;
    long    c;
    long    d;
}

Class CPacket : CObject
{

    CHeader mHeader;
    BYTE    mBody[BODY_SIZE];

    CPacket() {    }
    virtual ~CPacket() {    }
}

```

In other class' function, I have

```
void func()
{
    BYTE    mRcvData[PACKET_SIZE];

    CPacket   *packet = new CPacket();

    memcpy(packet->mHeader, mRcvData, HEADER_SIZE);
}

```

mRcvData is received from client by socket so I want to save the data into CPacket instance. To copy the header part of mRcvData into packet first, I used "memcpy" function as above but it didn't work.

My question will be,

First, how can I make it work as I intended?

Second, how is the member variables' address assigned in the CHeader Class and CPacket?
If I assigned "long c" after "BYTE b" like above, "long c" will have the address of "BYTE b"+1 ?

I mean, my logic is, for example, 

```
Address of CHEADER Class : @ 1000

Address of variable "a" in CHEADER Class : @ 1000

Address of variable "b" in CHEADER Class : @ 1001 (because "a" consumes 1 byte)

Address of variable "c" in CHEADER Class : @ 1002 (because "b" consumes 1 byte)

Address of variable "d" in CHEADER Class : @ 1006 (because "c" consumes 4 byte)

```

Is it true? what about "CPacket class"?