???????switch?????????????к????????????????????switch?????????????????????滻???????Ч???????????switch??????????????

enum MsgType{Msg1?? Msg2?? Msg3}
switch (ReceiveMessage()
{
case Msg1;
......
case Msg2;
.....
case Msg3;
.....
}

?????????????????????????δ??????滻????????switch???

/*???????*/
int handleMsg1(void);
int handleMsg2(void);
int handleMsg3(void);
/*??????????????????*/
int (*MsgFunction [])()={handleMsg1?? handleMsg2?? handleMsg3};
/*?????????и???Ч????????滻switch???*/
status=MsgFunction[ReceiveMessage()]();

??????10?????????C++?????????

????C++????????????????OOP????????????C????????г?Ч??????????????????????????????????????????C?????????????Щ???????????е?C++???????????????磬????????????????????к???г??????????????б?????? struct ????????ε??б????ж????????????????????????????С??????????????Ч?????C++??????С??????????塢?????????????????????????????С??Ч???и?????????????C++???Щ?????????????????Щ????????????ó???????

????4???????

?????????????????????????????????????????????????????????????????????????????????Ч????????????????????Щ???????????????????????????????Щ?????????????????????С??????????????????????????C/C++?? ?????????м???????С?????????????????????????????????????????????????????к???????????????????????????Ч????