Код: Выделить всё
#include
struct A { int a; };
struct I1 : A { int a; };
struct I2 : A { int a; };
struct D : I1, I2 { int a; };
using namespace std;
int main()
{
auto d = new D;
auto a = static_cast(d);
assert((void*)(a) != (void*)(d)); // OK
auto b = reinterpret_cast(d);
assert((void*)(b) == (void*)(d)); // OK under VC++. Is it guaranteed?
}
Подробнее здесь: https://stackoverflow.com/questions/223 ... ts-operand
Мобильная версия