#include
void f(){
static int i;
i=i+1;
printf("%d\n",i);
}
class widget{
public:
int i;
void f(int);
void g(int);
widget(int j=0):i(j){};
};
void widget::f(int i){printf("hello,world!\n");}
int main()
{
widget w;
widget * wp=&w;
void (widget:: * p)(int)=&widget::f;
(w.*p)(1);
(wp->*p)(2);
int widget:: *pp=&widget::i;
w.*pp=4;
printf("%d\n",w.i);
return 0;
}
阅读(772) | 评论(0) | 转发(0) |