[ create a new paste ] login | about

Link: http://codepad.org/JsOdJUvE    [ raw code | output | fork ]

C++, pasted on Dec 22:
#include <iostream>

struct BadObject{
 BadObject() {}
 BadObject(int i){ throw("Why you no word 0_o?"); }
};

struct GoodObject
{
 BadObject b;
 GoodObject(int i)
   try : b( BadObject(i) )
   {}
   catch(const char *p)
   { cout << "Runtime Error: " << p << endl; }
};

int main(){
 GoodObject obj(0);

 return 0;
}


Output:
1
2
3
Runtime Error: Why you no word 0_o?
char const* exception: Why you no word 0_o?
Aborted.


Create a new paste based on this one


Comments: