#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;
};

// std::unique_ptr<Airplane> process_airplane(std::unique_ptr<Airplane> airplane);
//
// u_p_airplane = process_airpalne(std::move(u_p_airplane));


int main() {
	std::shared_ptr<Airplane> a1;
	auto a2 = std::make_shared<Airplane>("DC8");

	a1 = a2;

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

	std::cout << "Count a1: " << a1.use_count() << " a2: " << a2.use_count() << '\n';

	std::shared_ptr<Airplane> a3;
	a3 = std::move(a1);

	std::cout << "Count a1: " << a1.use_count()
		<< " a2: " << a2.use_count() << " a3: " << a3.use_count() << '\n';

	auto a4 = std::make_unique<Airplane>("Mig21");

	std::shared_ptr<Airplane> a5;
	a5 = std::move(a4);

	u_p = std::move(s_p);
}

