class Base1
{
public:
virtual void foo();
};
class Base2
{
public:
virtual void foo();
};
class Derived : public Base1, public Base2
{
public:
virtual void foo();
};
#define SOMETHING 1
int main()
{
cout<< (int)static_cast<Base1*>((Derived*)SOMETHING) - SOMETHING <<endl;
cout<< (int)static_cast<Base2*>((Derived*)SOMETHING) - SOMETHING <<endl;
system("pause");
return 0;
}
{
public:
virtual void foo();
};
class Base2
{
public:
virtual void foo();
};
class Derived : public Base1, public Base2
{
public:
virtual void foo();
};
#define SOMETHING 1
int main()
{
cout<< (int)static_cast<Base1*>((Derived*)SOMETHING) - SOMETHING <<endl;
cout<< (int)static_cast<Base2*>((Derived*)SOMETHING) - SOMETHING <<endl;
system("pause");
return 0;
}