How to define a function pointer pointing to a static member function?

前端 未结 4 1515
北海茫月
北海茫月 2021-01-17 07:49
#include \"stdafx.h\"

class Person;
typedef void (Person::*PPMF)();

// error C2159: more than one storage class specified
typedef static void (Person::*PPMF2)();           


        
4条回答
  •  长情又很酷
    2021-01-17 08:06

    #include
    
    using namespace std;
    class A
    {
    private:
        int x,y;
        static int a;
    public:
        A()
        {
            x = 10;
            y = 11;
        }
        ~A()
        {
    
        }
    
        void displayNonStatic()
        {
            cout<error
      // (*_static)(); ->error
        getchar();
    }
    

    Refer to the link for more information.

提交回复
热议问题