◄Up► ◄Contents► ◄Index► ◄Back► ──────────────────────────────────────────────────────────────────────────── Compiler error C2642 cast to pointer to member must be from related pointer to member A pointer to a member was cast to a pointer to a member of a class (or structure) that was not a derived or base class. The following is an example of this error: class B { public: int b: }; class C {}; int C:: cpb = (int C::*)&B::b; // error class D : public B { public: int d; }; int D:: dpb = (int D::*)&B::b; // OK, B is a base class of D int B:: bpd = (int B::*)&D::d; // OK -♦-