#include <iostream>
#include <string>
#include <memory>


class Airplane {
public:
	explicit Airplane(const std::string & name_)
		: name{name_} {
		std::cout << "Construct Airplane name = " << name << '\n';
	}
	const std::string & get_name() const {
		return name;
	}
	~Airplane() {
		std::cout << "Destruct Airplane name = " << name << '\n';
	}
private:
	const std::string name;
};

void info(std::unique_ptr<Airplane> ptr) {
	std::cout << "In info()\n";
	std::cout << ptr->get_name() << '\n';
	std::cout << "End of info()\n";
}

int main() {
	std::unique_ptr<Airplane> a1;
	{
		auto a2 = std::make_unique<Airplane>("F22");

		a1 = std::move(a2);

		std::cout << "End of scope\n";
	}
	std::cout << "Out of scope\n";

	std::cout << a1->get_name() << '\n';

	auto a3 = std::make_unique<Airplane>("Pirat");

	std::cout << "Before info()\n";
	info(std::move(a3));

	std::cout << "After info()\n";

	std::cout << "End main()\n";
}

