我在一个c++的类中一个函数funcA()中
声明了一个指针变量LRESULT* pL(int a, POINT *b),
在该类的一个成员函数中要取指向另一个成员函数funcB(int a, POINT *b),的指针,
付给该指针pL:  pL =funcB;
可是总是出错误,通不过编译,请问应该怎样做?

解决方案 »

  1.   

    你可以用函数指针.void (*pl)(int,POINT);现在就可以赋:pl=funcB;
      

  2.   

    而且你声明的函数指针是错误的。
    要这样:
    LRESULT  (*pL)(int a, POINT *b)
      

  3.   

    class A
    {
    typedef void (A::*p)(int,point); // 利用typedef重新命名类成员函数指针。
    funcA(p);
    }
      

  4.   

    to ouyh12345() ( ) 信誉:100 
    指针是可以指向成员函数的。类名::*pl(int, POINT*) = &类名::funcB;
      

  5.   

    少了个返回类型LRESULT 类名::*pl(int, POINT*) = &类名::funcB;
      

  6.   

    我在vc++6.0下编译,还是出错,错误提示如下:
    1. error C2276: '&' : 试图取得虚函数的地止
    2. error C2440: 无法从'type cast' : 'long (__thiscall CMyclass::*)(int, POINT*)' 向 'int (__stdcall *)(void)' 变换
      

  7.   

    少了一句话:
    error 2 是在以下的调用中出现的LRESULT 类名::*pl(int, POINT*) = &类名::funcB;
    DaRegistCustomRubber(sizeof(CST_RB), (PROC)pl);
      

  8.   

    class MyClass
    {
        typedef void (A::*p)(int,point); 
        void function(int,point); 
        ...
        void other_func()
        {
            p pfunc = MyClass::function;
        }}调用的时候需要对象指针的,函数指针本身不够。
      

  9.   

    LRESULT (*pL)(int a, POINT *b);
    pL = ClassPTR->funcB;
      

  10.   

    class  CFoo
    {
    typedef void (CFoo::*PFOO)(int);
    PFOO pFoo;
    public:
    void Foo(int i)
    {
    pFoo=Func;
    (this->*pFoo)(i);
    }
    void Func(int i){}};20分,少一分不要,多一份不要(=_=)