C1395: Classes should be the same or derive one from another

[ERROR]

Description

Pointer to member is defined to point on a class member, then classes (the one which member belongs to and the one where the pointer to member points) have to be identical. If the member is inherited from a base class then classes can be different.

Example
  class A{

  
  public:

  
    int a;

  
    void fct1(void){}

  
  };

  
  class B{

  
  public:

  
    int b;

  
    void fct2(void){}

  
  };

  
  void main(void){

  
    int B::*pmi = &A::a;

  
    void (B::*pmf)() = &A::fct1;

  
  }

  
Tips

Use the same classes

  class A{

  
  public:

  
    int a;

  
    void fct1(void){}

  
  };

  
  class B{

  
  public:

  
    int b;

  
    void fct2(void){}

  
  };

  
  void main(void){

  
    int A::*pmi = &A::a;

  
    void (A::*pmf)() = &A::fct1;

  
  }

  

Use classes which derive one from an other

  class A{

  
  public:

  
    int a;

  
    void fct1(void){}

  
  };

  
  class B : public A{

  
  public:

  
    int b;

  
    void fct2(void){}

  
  };

  
  void main(void){

  
    int B::*pmi = &A::a;

  
    void (B::*pmf)() = &A::fct1;

  
  }