C/C++ Compiler (cl.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
C2642
                                             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
                                    -♦-