Guest User

Untitled

a guest
Nov 24th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.19 KB | None | 0 0
  1. struct A
  2. {
  3. int something_old;
  4. };
  5.  
  6. struct B : public A
  7. {
  8. int something_new;
  9. };
  10.  
  11. auto aa = GetAn_A(); // for example
  12. :
  13. B bb;
  14. *(A*)&bb = aa; // <-- code smell?
  15. bb.something_new = 42;
Add Comment
Please, Sign In to add comment