You can
MyClass* pMyClass = const_cast<MyClass*>( static_cast<const MyClass*>(pThis) );
But this awful syntax is a hint: why then does the function have a const argument, would you like it to look like
void func1(void * pThis) {
Of course, you can use the shortcut with the C-style cast:
MyClass* pMyClass = (MyClass*)pThis;
but instead, I will correct the design if possible.
source share