#include <iostream>
#include <string>
#include <exception>

using namespace std;

class MyException : public exception
{
public:
    // exception specifications (throw lists) are deprecated.
    // use the noexcept keyword to indicate a function doesn't throw.
    virtual const char* what() const noexcept    
    {
        return "Something bad happened";
    }
};

class Test
{
public:
    void goesWrong()  // exception specifications are deprecated
    {
        throw MyException();
    }
};

int main()
{
    Test test;

    try
    {
        test.goesWrong();
    }
    catch (exception &e)
    {
    	cout << "First catch: ";
        cout << e.what() << '\n';
    }

    try
    {
        test.goesWrong();
    }
    catch (exception e)
    {
    	cout << "Second catch: ";
        cout << e.what() << '\n';
    }
}