470,870 Members | 1,403 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

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


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


Feb 22 '08 #1
0 1029

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
By using this site, you agree to our Privacy Policy and Terms of Use.