template<typename T>
int virtualBaseTableOffset(T* b, int i)
{
return (int)*((int*)*(int*)b + i);
}
class Base
{
public:
int base_member;
inline virtual void vfBase()
{
cout << "This is in Base::vfBase()" << endl;
}
};
class Derived1 : public virtual Base
{
public:
int derived1_member;
inline void vfBase()
{
cout << "This is in Derived1::vfBase()" << endl;
}
inline virtual void vfDerived1()
{
cout << "This is in Derived1::vfDerived1()" << endl;
}
};
class Derived2 : public virtual Base
{
public:
int derived2_member;
inline void vfBase()
{
cout << "This is in Derived2::vfBase()" << endl;
}
inline virtual void vfDerived2()
{
cout << "This is in Derived2::vfDerived2()" << endl;
}
};
class ChildDerived : public Derived1, public Derived2
{
public:
int childderived_member;
inline void vfBase()
{
cout << "This is in ChildDerived::vfBase()" << endl;
}
inline void vfDerived1()
{
cout << "This is in ChildDerived::vfDerived1()" << endl;
}
inline void vfDerived2()
{
cout << "This is in ChildDerived::vfDerived2()" << endl;
}
};
int main(void)
{
ChildDerived cd;
VFun pVF;
int* tmp;