468,484 Members | 1,749 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,484 developers. It's quick & easy.

copy derived structure, is it legal c++ code?

Hi,

I am trying to copy some variables from a struct to a derived struct.
If I have something like,

....
struct STRUCTA
{
int numA;
long numB;
float numC;
}

struct STRUCTB public STRUCTA
{
int numD;
}
....

STRUCTA structA = {0,1,2};
STRUCTB structB;
memcpy( &structB, &structA, sizeof( STRUCTA) );

....
//
Is the above code legal to copy the structure from structA to structB

Thanks

F.
Feb 22 '08 #1
0 979

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by Simon Elliott | last post: by
42 posts views Thread by Edward Diener | last post: by
3 posts views Thread by mescaline | last post: by
5 posts views Thread by lion | last post: by
3 posts views Thread by Sakharam Phapale | last post: by
reply views Thread by NPC403 | last post: by
2 posts views Thread by gieforce | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.