Your x and y pointers actually point to subobject B of objects B and C (using the most derived type).
Example:
int main() {
C c;
B *pb = &c;
void *pvc = &c;
void *pvb = pb;
cout << boolalpha;
cout << (pvc == pvb) << '\n';
cout << (&c == pb) << '\n';
C *pc = static_cast<C*>(pb);
cout << (pc == &c) << '\n';
return 0;
}
? static_cast void * ( reinterpret_cast), void , void:
reinterpret_cast<C*>(pvb)
Roger Pate