#include <memory>
#include <stdexcept>
#include <iostream>

struct Object 
{
    Object() { std::cout << "An Object is created!\n"; }
    ~Object() { std::cout << "An Object is destroyed!\n"; }
};

class MyClass
{
    std::unique_ptr<Object> _object;

    void methodThatWillCauseException()
    {
        throw std::runtime_error("ERROR: gratuitous exception");
    }
public:

    MyClass() : _object(new Object)
    {
        methodThatWillCauseException();
    }
};

int main()
{
    try {
        MyClass Instance;
    }
    catch (std::exception& ex)
    {
        std::cout << ex.what() << '\n';
    }
}