类定义中.h
enum { FuncNum = 2 }; //当前支持糊牌种类的数目
void (CClient::*pFunc[FuncNum])(); //糊牌函数指针
在构造函数中
pFunc[0] = &CClient::Style_1;
pFunc[1] = &CClient::Style_2;
成员函数动用
for (int n=0; n<FuncNum; n++)
(this->*pFunc[n])();
enum { FuncNum = 2 }; //当前支持糊牌种类的数目
void (CClient::*pFunc[FuncNum])(); //糊牌函数指针
在构造函数中
pFunc[0] = &CClient::Style_1;
pFunc[1] = &CClient::Style_2;
成员函数动用
for (int n=0; n<FuncNum; n++)
(this->*pFunc[n])();
解决方案 »
- 非SDI/MDI,CDialog类怎么获取CDoc类的指针
- 数组不能赋值?是函数模板下对数组元素赋值,编译没问题,输出是随机数
- 如何一次性清除所有的断点
- 如何将usb设备识别出来是哪一类
- 我觉得现在faq栏目搞得很不方便,很不好,大家讨论一下
- [求助]用CInternetSession::GetHttpConnection建立与http服务器的连接后,怎样再检验http服务器返回的状态代码,如200,500,401错误等?
- 关于线程同步的问题,百思不得其解!!
- 有没有WINDOWS版本的command.com?
- 高分求;自动曝光的原理及实现。
- 如何 从一个文件中正确读出一个long型 数据 ?
- 如何自己绘制窗口的Title bar????
- 进度条问题。
LPMYFUNCTYPE pFunc[XXX]; // Assume you have XXX functions// How to call?
pFunc[i](1, 2, ...);// That's all.
using namespace std;typedef void (*MyFunDef)(const char*);void hello(const char *s)
{
cout << "hello, " << s << endl;
}void shakehand(const char* s)
{
cout << "let's shake hand, " << s << endl;
}MyFunDef fArray[] = {hello,shakehand};int main()
{
char* name = "myheart8541_cn";
for (int i=0; i < sizeof (fArray)/sizeof(fArray[0]);i++)
(*fArray[i])(name);
return 0;
}