Advertisement
Guest User

Untitled

a guest
Jun 10th, 2015
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. #include <memory>
  2.  
  3. class Item {
  4. public:
  5.     int k;
  6.     Item(int k) : k{ k } {}
  7. };
  8.  
  9. class Car {
  10. public:
  11.     Car(int type) {}
  12. private:
  13.     std::unique_ptr<Item> type{ new Item{5} };
  14. };
  15.  
  16. class Human {
  17. public:
  18.     Car c{ 1 };
  19. };
  20.  
  21. int main() {
  22.     Human h;
  23.     Car c2{ 2 };
  24.     h.c = std::move(c2);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement