// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
#include <iostream>
#include <string>

using namespace std;

struct Foobar
{
    int iv;
    string sv;
};

int main()
{
    try
    {
        throw 123;
    }
    catch(int ex)
    {
        cout << "Vi hapsede " << ex << endl;
    }
    try
    {
        throw string("abc");
    }
    catch(string ex)
    {
        cout << "Vi hapsede " << ex << endl;
    }
    try
    {
        Foobar fb;
        fb.iv = 123;
        fb.sv = "abc";
        throw fb;
    }
    catch(Foobar ex)
    {
        cout << "Vi hapsede " << ex.iv << " & " << ex.sv << endl;
    }
    return 0;
}
