#include #include using namespace std; class Dog { string name; string breed; public: Dog(const string& n = "Fido", const string& b = "mutt") : name(n), breed (b) { } friend ostream& operator<<(ostream& o,const Dog& dog) { return (o << dog.name << " is a " << dog.breed); } }; void funk(int i) { try { switch (i) { case 1: throw("Have a nice day"); case 2: throw(5); case 3: throw(3.14); case 4: throw(5L); case 5: throw(&i); case 6: throw(Dog()); } } catch(const char* it) { cout << "You threw me a const char*: " << it << endl; } catch (const string& it) { cout << "You threw me a const string&: " << it << endl; } catch(int it) { cout << "You threw me an int: " << it << endl; } catch(float it) { cout << "You threw me a float: " << it << endl; } catch(double it) { cout << "You threw me a double: " << it << endl; } catch(long it) { cout << "You threw me long: " << it << endl; } catch(int* it) { cout << "You threw me an int address: " << it << endl; } catch(Dog it) { cout << "You threw me an Dog: " << it << endl; } } int main() { funk(1); funk(2); funk(3); funk(4); funk(5); funk(6); cout << "End of program\n"; }