Calling Member Function Pointers

怎甘沉沦 提交于 2019-12-06 01:31:38

The pointer-to-member-function is a pure class property. You need to combine it with a class instance in order to make a meaningful function call. For example, to use the instance *this, you can use the operator ->* and say:

(this->*CmdTable[0])(i);

Or you can use operator .* on an object value:

(*this.*CmdTable[0])(i);

The latter form is always correct. For the former, note that operator->* may be overloaded and do something unrelated.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!