首先定义:
typedef void (*PFUNC2)(CDC*,PSR);  //#define struct SngRect{..} *PSR
PFUNC2 funTable[3];
然后定义了:
void CGameView::DrawSngEraseNear(CDC *pdc, PSR p)
如下赋值出现错误:
funTable[0]=DrawSngEraseNear;
错误提示:
 error C2440: '=' : cannot convert from 'void (__thiscall CGameView::*)(class CDC *,struct SngRect *)' to 'void (__cdecl *)(class CDC *,struct SngRect *)'
        There is no context in which this conversion is possible

解决方案 »

  1.   

    funTable[0] = DrawSngEraseNear; 这句你放错地方了以下代码没有问题的:typedef void (*PFUNC)(int, int);PFUNC FUNCARRAY[3];void func(int a, int b);int main(int argc, char* argv[])
    {
    FUNCARRAY[0] = func; return 0;
    }void func(int a, int b)
    {
    }
      

  2.   

    cannot convert from 'void (__thiscall CGameView::*)(class CDC *,struct SngRect *)' to 'void (__cdecl *)(class CDC *,struct SngRect *)'--错误提示已经很明显了。
    DrawSngEraseNear是CGameView的成员函数,拥有this指针,它的参数个数实际上与PFUNC不同。用静态成员函数