error C2440: '=' : cannot convert from 'void (__thiscall CMySync::*)(struct My_CV *,unsigned short)' to 'void (__cdecl *)(struct My_CV *,unsigned short)'
        There is no context in which this conversion is possible
我在CMySync类中定义了mut函数 void mut(My_CV *cvt, Uint16 format);然后在某段程序中写入
void (*rate)(My_CV *cvt, Uint16 format);
rate=mut; //这里出错了

解决方案 »

  1.   

    void (CMySync::*rate)(My_CV *cvt, Uint16 format);
      

  2.   

    对不起,我错了.
    不能把成员函数赋给全局函数,因为成员函数隐含一个this指针参数。
      

  3.   

    typedef struct My_CV  {
    int look;
             bool sem; /* Set to 1 if 
    void (*filters[10])(struct My_CV *cvt, Uint16 format);
             int index;} My_CV;CMySync::Afilter(struct My_CV *cvt, Uint16 format);
    {
      .....
    }CMySync::Bfilter(struct My_CV *cvt, Uint16 format);
    {
      .....
    }
    CMySync::Cfilter(struct My_CV *cvt, Uint16 format);
    {
      .....
    }
    CMySync::Dfilter(struct My_CV *cvt, Uint16 format);
    {
      .....
    }
    CMySync::SelectFilter(struct My_CV *cvt, Uint16 format,Uint16 chanelname,Uint8 howlongtime );
    {
      在这里面判断用A,B还是C,还是D,用哪一类filter.
      switch(judgeAorBorCorD)
      {
        case A:
            cvt->filters[cvt->index++] =Afilter;
        case B:
            cvt->filters[cvt->index++] =Bfilter;
        case C:
            cvt->filters[cvt->index++] =Cfilter;
        case D:
            cvt->filters[cvt->index++] =Dfilter;
        break;
        }        
        
    }
    就是这样的程序。现在这4个case里面的句子都不对。/
      

  4.   

    这种类似回调函数(4个Filter)只能做成static or global的~~~
      

  5.   

    应该可以这么用
    (this->*pfn)(...)...