I am getting this error while running this code. Please look in to my code and assist me.
#include "stdafx.h"
#include <iostream>
class A
{
public:
void PrintTwoNumbers(int (*numberSource)(void))
{
int val1= numberSource();
}
int overNineThousand(void)
{
return (rand()%1000) + 9001;
}
};
int _tmain(int argc, _TCHAR* argv[])
{
int (A::*fptr) (void) = &A::overNineThousand;
int (A::*fptr1) (void);
fptr1 = &A::overNineThousand;
A a;
a.PrintTwoNumbers(&fptr); //-> how to pass here
getchar();
return 0;
}
I am fed up by searching this online, and nobody is giving a perfect solution for this.Can anybody edit this code as working code and help me?