Thank for your answer... I thought that m_fsendOriginal is my function pointer and my local variable... until I know, its behavior is as any other pointer, but in this case is a function pointer...
So my friend, how would be ?? because now I'm not clear about how canI do it
It is a static variable of class. They have to be defined beforehand.
its behavior is as any other pointer
Yes. The fact that it is a function pointer is irrelevant. You would be having same problem with just a simple int.
So my friend, how would be ?? because now I'm not clear about how canI do it
Define it in implementation file of your class:
1 2 3 4 5
//A type alias to avoid typing function pointer type in future
using Ppyfsend = int (*)(struct soap*, constchar*, size_t);
//Set m_fsendOriginal to null pointer at start
Ppyfsend PpySuscripcionWsClient::m_fsendOriginal = nullptr;
using Ppyfsend = int (*)(struct soap*, constchar*, size_t);
Ppyfsend PpySuscripcionWsClient::m_frecvOriginal;
and the output was:
PpySuscripcionWsClient.h:48:11: error: expected nested-name-specifier before ‘Ppyfsend’
PpySuscripcionWsClient.h:48:11: error: using-declaration for non-member at class scope
PpySuscripcionWsClient.h:48:20: error: expected ‘;’ before ‘=’ token
PpySuscripcionWsClient.h:48:20: error: expected unqualified-id before ‘=’ token
PpySuscripcionWsClient.h:50:5: error: ‘Ppyfsend’ does not name a type
using Ppyfsend = int (*)(struct soap*, constchar*, size_t);
is a c++11 code until I know, If I use this declaration in the cpp file, I had the following error:
PpySuscripcionWsClient.cpp:23:11: error: expected nested-name-specifier before ‘Ppyfsend’
PpySuscripcionWsClient.cpp:23:11: error: ‘Ppyfsend’ has not been declared
PpySuscripcionWsClient.cpp:23:20: error: expected ‘;’ before ‘=’ token
PpySuscripcionWsClient.cpp:23:20: error: expected unqualified-id before ‘=’ token
because the system is deployed in old debian version using gcc 4.1, and I'm new in my job (only 3 weeks)... I love c++14, in my personal projects I work with it because clang support it, but in my job i can't use it !!!