
#include <stdio.h>

class A
{
public: virtual void* getThis()
{ return this; }
};

class B : virtual public A
{
public: virtual void* getThis()
{ return this; }

public: virtual void printB()
{ puts("B"); }
};

class C : virtual public A
{
public: virtual void* getThis()
{ return this; }

public: virtual void printC()
{ puts("C"); } 
};

class D : public B,
	  public C
{
public: virtual void* getThis()
{ return this; }
};

int main ()
{
	D o;
	B* pB = reinterpret_cast<B*>( o.getThis() );
	C* pC = reinterpret_cast<C*>( o.getThis() );

	pB->printB();
	pC->printC();

	return 0;
}

