异常处理

#include <iostream>
#include <stdexcept>
using namespace std;

class SimpleExceptionpublic exception { };

class RecommendExcpublic runtime_error {
    public:
    //recommended constructors
    RecommendExc() : runtime_error("RecommendExc") { }
    RecommendExc(const char* msg) : runtime_error(msg) { }
    RecommendExc(const string& msg) : runtime_error(msg) { }
};

//throw SimpleException();

try {
    throw RecommendExc("exeption");
}
catch (runtime_error & e) {
    cout << e.what();
}