Hello everyone.
I need help making (as everyone does) a game. There is a base class that implements some basic attibutes for moving objects. There are other derived classes that change the behavior of the movement. The problem is that the constructor creates a thread to update the position (and speed) of the object. Each class has its own method to update, hence, the method is virtual. I know that I can create one huge thread and call the virtual method on an array of the objects, but I am curious. I created a pointer to a member function, but it is not of type (void*)(*)(void*), as thread needs. Please, ask me to explain again if my english is too bad.Here a small example:
Code:
//header.h
class Base{
public:
   Base();
   virtual void* update(void*)=0;
private:
   // does not matter
};

class Creature : public Base{
public:
   Creature();
   void* update(void*)
private:
   // who cares...
};
Code:
//implementation.cpp
Creature::Creature()
{
   void*(Creature::*f)(void*) = &Creature::update;
   // will create thread here, but type of "f" is not void*(*)(void*)
}
Tnx any help!