#include<iostream>
#include <exception>
#include <stdexcept>
using namespace std;
class CException:public std::exception
{
public:
std::string s;
CException(std::string ss):s(ss)
{
}
~CException()throw()
{
}
const char* what() const throw()
{
return s.c_str();
}
};
int main()
{
try
{
throw CException("11");
cout << "end try" << endl;
}
catch(std::exception& e)
{
cout << "CException: " << e.what() << endl;
}
cout << "end" << endl;
}
#include <exception>
#include <stdexcept>
using namespace std;
class CException:public std::exception
{
public:
std::string s;
CException(std::string ss):s(ss)
{
}
~CException()throw()
{
}
const char* what() const throw()
{
return s.c_str();
}
};
int main()
{
try
{
throw CException("11");
cout << "end try" << endl;
}
catch(std::exception& e)
{
cout << "CException: " << e.what() << endl;
}
cout << "end" << endl;
}