I am trying pass the function as an argument, the Testabc is inherited from MainTest and the function I want to pass is protected function in MainTest class. I do not have the cpp access to the MainTest class which has this protected ReadTestPoint function.
Below is header file where I define the function that is taking the function as an argument.
#include <QObject>
#include <QDebug>
class TestManager
{
 public:
 TestManager();
~TestManager() {}
int ReadTestPointer(void *dp, unsigned int &val, int (*functioncall)(void *, 
unsigned int&));
};
Below is the cpp for the TestManager
#include "testmanager.h"
#include<QDebug>
TestManager::TestManager(){}
int TestManager::ReadTestPointer(void* dp, unsigned int &num, int (*readt)
(void*, unsigned int&))
{
   qDebug()<< "Function Pointer working";
   int g;
   g = (*readt)(dp, num);
   return g;
}
The class from where I am making the call:
 namespace PackageCore
 {
 TestAbc::TestAbc() : MainTest(){}
 TestAbc::~TestAbc(){}
 int TestAbc::Init()
 {
  // initialization code called once
   m_config = reinterpret_cast<Test_BaseClass*>
   (GetConfig(Test_BaseClass_INTERFACE_HASH));
  return 0;
}
int TestAbc::DeInit()
{
   return 0;
}
int TestAbc::Cycle()
{
   TestManager m_TestManager;
   unsigned int m_trigger;
   int (*abc)(void *, unsigned int&) = ReadTestPoint(m_config-
    >SHM_B_Trigger_U8, m_trigger);
   m_TestManager.ReadTestPointer(m_config->SHM_B_Trigger_U8, m_trigger, abc);
   qDebug()<< " getTrigger: " << m_trigger;
   return 0;
}
}
But I get the compile time error on this:
C:\test_manager_git\testabc.cpp:39: error: invalid conversion from 'int' to 'int (*)(void*, unsigned int&)' [-fpermissive]
 int (*abc)(void *, unsigned int&) = ReadTestPoint(m_config->SHM_B_Trigger_U8, m_trigger);
                                                                                            The MainTest.h is below:
   class MainTest : public QObject
  {
   Q_OBJECT
   public:
    // Callbacks
    virtual int Init() = 0;
    virtual int Cycle() = 0;
    virtual int DeInit() = 0;
   protected:
     int ReadTestPoint (void *dp, unsigned int &val);
 };
Thanks
 
    