Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <memory>
- class Item {
- public:
- int k;
- Item(int k) : k{ k } {}
- };
- class Car {
- public:
- Car(int type) {}
- private:
- std::unique_ptr<Item> type{ new Item{5} };
- };
- class Human {
- public:
- Car c{ 1 };
- };
- int main() {
- Human h;
- Car c2{ 2 };
- h.c = std::move(c2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement