Can you guess what the following program writes to standard output when run?

#include <iostream>
#include <stdexcept>

struct foo : std::exception
{
  char const * what() const throw() { return "foo"; }
};

struct bar : std::exception
{
  char const * what() const throw() { return "bar"; }
};

struct foobar : foo, bar
{
  char const * what() const throw() { return "foobar"; }
};

int main(int, char * [])
{
  try
  {
    throw foobar();
  }
  catch(std::exception const & e)
  {
    std::cout << e.what() << std::endl;
  }
  catch(...)
  {
    std::cout << "*** program terminated because of unknown error" << std::endl;
  }

  return 0;
}