Is it possible to call a member function with a specific object instance when only owning a void*
pointer to the specific instance and a returnType(*function)(parameters)
function pointer?
#include <iostream>
class testClass
{
public:
int classNum;
testClass(int _num) : classNum(_num) {}
void testFunction(int _num) { std::cout << _num + classNum << "\n"; }
};
int main()
{
testClass instance(3);
void(*function)(int) = (&testClass::testFunction); // edit: this is wrong, but "&test::testFunction" is the information provided nonetheless
void* instancePtr = (void*)&instance;
// can we call "testFunction(3)" on "instance" with only "function" and "instancePtr"?
}