#include <iostream>

using namespace std;

struct B {
  int f() { cout << "B::F\n"; }
};

struct A { int x; A() : x(42) {} };

struct D : A, B {
  int g() { cout << "D::G" << x << "\n"; }
};

int main()
{
  D d;
  B b;
  B* pb = &b;
  int (B::*pf)() = &B::f;
  (pb->*pf)();

  pb = &d;
  pf = (int(B::*)())&D::g;
  (pb->*pf)();
  return 0;

}
