class A {};class B : public A {};class Meh {};class C : public B, Meh {};Foo::Foo(A* a){ m_pAObject = a; m_pCObject = reinterpret_cast<C*>(a);}void C::SomeMethod(){ this->DoStuff(); // <-- "this" and m_pCObject above don't match}
C::C is only invoked once, but when I examine these guys in debugger the pointer assigned to m_pCObject and the this pointer when tracing in C are two different things--specifically, m_pCObject is 64 greater than the this pointer inside of C methods. The objects methods are only invoked as an instance of C from other places, so it hasn't been an issue. I added some methods to C so that Foo could notify it of some state change, and it is behaving as though it is pointing to a different, uninitialized instance.
Is there some behavior around the casting here that I'm not aware of? (I'm not able to use dynamic_cast, but I know that the A object will always be a C object.)