#include <stdio.h>

class A;
class B;
class C;

C* doCast(B* b)
{
  return(C*)b;
}

class A
{
public:
  virtual void func(void) {};
  int i;
};

class B
{
public:

    virtual void func2(void) = 0;
};

class C : public A, public B
{
public:
  virtual void func(void) { printf("func1"); }
  virtual void func2(void) { printf("func2"); }
};


int main(void)
{
  B* a = new C();
  printf("A is %x\n", a);
  // Do a C++ style static cast. This is *exactly* the same as a C-style
cast, BUT the compiler will refuse to do the cast based only on a forward
  // declaration. The result is correct.
  printf("B is %x\n", static_cast<C*>(a));
  // Do a C-style cast which was compiled before the class was fully
defined. The result is INCORRECT
  printf("B is %x\n", doCast(a));
  // Do a C-style cast which was compiled after the class was fully
defined. The result is correct
  printf("B is %x\n", (C*)a);
  return 0;
}