指向类成员函数指针的问题
下面这个程序使用函数指针指向类A的成员函数fc,编译有误,不知道有什么语法错误?
#include<iostream>
#include<conio.h>
using namespace std;
class A
{public:int fc(void);
private:int a;};
int main()
{int (A::*f)(void);
A x;
x.fc();
f=A::fc;
(x.f)();
getch();
return 0;}
int A::fc(void)
{cout<<"a="<<a<<endl;
a+=5;
cout<<"a="<<a<<endl;}