#include<iostream>
using namespace std;
class A
{
public:
int fun(int b) { return a * c + b; }
A(int i, int j) { a = i; c = j; }
int c;
private:
int a;
};
int A::* pa = &A::c; // 定义指向A类的数据成员c
int (A::* pc)(int) = A::fun; // 定义指向A类的函数成员fun
int main()
{
A s1(2, 6);
cout << s1.fun(10) << endl;
cout << s1.*pa << endl;
A* p = &s1;
cout << (p->*pc)(10) << endl;
return 0;
}
为什么以上代码在DEVC可以编译通过,在VS2019,没显示错误但是编译不通过