#include <iostream.h>
class Sample{
int x,y;
public:
Sample(int a,int b){
x=a;
y=b;
}
int getx(){return x;}
int gety(){return y;}
};
void main(){
int (Sample::*fp)();
fp=&Sample::getx; //语句1
Sample s(2,7);
int v=(s.*fp)();
cout<<v;
}
请问,类在创建对象以前不是不分配内存吗,怎么语句1可以得到函数getx的地址呢?