I have class named cTPS, there are 3 member functions called matrixP_2, matrixP_3 and matrixP_4 for calculating matrixP in three different ways.

In constructor of this class I want to initialize a pointer declared in cTPS.h like this:

cMatrixBase *(cTPS::*matrixP)(void) //pointer MatrixP returning object cMatrixBase

I initialize it for example like this in constructor:

matrixP = &cTPS::matrixP_3 //pointer matrixP should point to member function matrixP_3

Up to this point everything is OK, no compiler errors.

And now, where's the probem: In the main.cpp I call function matrixP_3 via pointer matrixP in this line:

ComputedMatrixP->assign( (void *)TPSCalculation.matrixP)

Object ComputedMatrixP is object of class cMatrixBase and via it's 'assing' function I assign to it object, which is returned by called matrixP_3 function (via it's pointer matrixP).

On this line I get this error:

'type cast' : cannot convert from 'cMatrixBase *(__thiscall cTPS::* )(void)' to 'void *'

I think, it's something connected with 'assign' function of class cMatrixBase, this function looks like this:

void cMatrixBase::assign(void *assigned_matrix)
(*matrix) = *((static_cast<cMatrixNewmat *>(assigned_matrix))->matrix);

If someone could help me, I would really appreciate it :)

Pointers to member functions and pointers to void are not compatible types. Figure out another solution that doesn't require this conversion.