In that code fragment:
static SG_SRVR_RTC classCSgObj=
(PFNCREATE)(CSgObj::_CreateNew),
};
a { and an & are missing and the cast is not required. It could be as simple as:
static SG_SRVR_RTC classCSgObj=
{
&CSgObj::_CreateNew,
};
And for the call itself, most important parenthesis are missing. It should be:
return (this->*(pRTC->pfnCreate))();
Or if you prefer, they are badly placed as the following seems to also compile:
return (this->*pRTC->pfnCreate)();
It make sense are () have higher priority and without parenthesis around the whole
this->*pRTC->pfnCreate
expression, the parenthesis would be applied only to it immediate left sub expression. That is the compiler would try to evaluate
(pRTC->pfnCreate)()
first and then
this->*
result_of_ previous_expression.
In fact it must first get the pointer to the function
this->*pRTC->pfnCreate
(this is why it must be in parenthesis) and then call the function on that.