C++ using function as parameter

后端 未结 3 1018
臣服心动
臣服心动 2020-12-29 06:37

Possible Duplicate:
How do you pass a function as a parameter in C?

Suppose I have a function called

3条回答
  •  死守一世寂寞
    2020-12-29 07:13

    check this

    typedef void (*funct2)(int a);
    
    void f(int a)
    {
        print("some ...\n");
    }
    
    void dummy(int a, funct2 a)
    {
         a(1);
    }
    
    void someOtherMehtod
    {
        callback a = f;
        dummy(a)
    }
    

提交回复
热议问题