D
D
Daniel2018-10-19 06:29:29
C++ / C#
Daniel, 2018-10-19 06:29:29

How to pass a function pointer and store into another function pointer, c++?

class A{
private:
   void (* func()); // нужно сюда сохранить функцию, как????
public:
   A(  void (*_func() ){
          func=_func;  // ошибка компиляции
       // auto f =_func; // работает, значит я не правильный тип выбрал при обьявлениие
      
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2018-10-19
@jcmvbkbc

void (* func())

It's some kind of nonsense (namely, a function that returns void *), not a function pointer. The function pointer looks like this:
void (*func)()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question