Should I expect that upcasts and downcasts in single inheritance don't adjust the pointer?
问题 Suppose I have: class Base { public: virtual void Nothing() {} }; class MiddleDerived : public Base { virtual void Nothing() {} }; class Derived : public MiddleDerived { virtual void Nothing() {} }; and my code goes like this: Derived* object = new Derived(); Base* base = object; //implicit conversion here void* derivedVoid = object; void* baseVoid = base; Should I expect that baseVoid == derivedVoid ? I know that most implementations work this way but is it guaranteed? 回答1: What you "should