#include<iostream> using namespace std; void f(); class T { public: T() { cout<<"constructor"<<endl; try { throw "exception"; } catch( char * ) { cout<<"exception1"<<endl; } throw "exception"; } ~T() { cout<<"destructor"; } }; int main() { cout<<"main function "<<endl; try { f(); } catch( char * ) { cout<<"exception2"<<endl; } cout<<"main function "<<endl; } void f() { T t; }
main function
constructor
exception1
exception2
main function