#include <iostream>

using namespace std;

struct A {
  int a;
};

struct B {
  int b;
};

struct C: A, B {
  int c;
};


struct Base {
  virtual B* func() = 0;
  virtual ~Base() = default;
};

struct Derived: Base {
  C* func() {
    auto p = new C;
    cout << p << endl;
    return p;
  }
};


int main() {
  Base* pb = new Derived;
  cout <<  pb->func() << endl;
  // the outputed two addresses are different.
  // how is the pointer cast (adding some offset) achieved?
}
