Have a look at is simple example:
struct Base { /* some virtual functions here */ }; struct A: Base { /* members, overridden virtual functions */ }; struct B: Ba
Yes, It does have undefined behavior. The layout about suboject of Base in A and B is undefined. x may be not a real Base oject.