#include <memory>
#include <iostream>

class A
{
public:
    A() { std::cout << "Hi" << std::endl; }
    ~A() { std::cout << "Bye" << std::endl; }
};

class B
{
public:
    B(): a(new A()) {};
    //~B() {} <-- destructor is no longer needed, the unique_prt will delete the object for us
private:
    std::unique_ptr<A> a;
};

int main(int argc, char* argv[])
{
    B b;
}