#include <iostream>
#include <memory>

struct A
{
  virtual void process();
};

struct B : public A
{
  virtual void process();
};

void A::process() { std::cout << "A process" << std::endl; }
void B::process() { std::cout << "B process" << std::endl; }

typedef std::auto_ptr<B> (*func_def)();

std::auto_ptr<B> f()
{
  return std::auto_ptr<B>(new B);
}

int main()
{
  //  f();
  func_def func = f;
  std::auto_ptr<A> test((*func)());
  test->process();
}