I want to create a library that contains a class world that can, among other things, hold pointers to entity-objects within a virtual world.
The entity-class will be defined in a header file for the library. Someone using the library should be able to create his own derived classes of the entity class and register instances of that derived class to the world object (like world->registerEntity(FrogEntity)).
Using the pointer the world object received from its register method, it should be able to call methods of the derived class of entity.
It's probably to complicated or not even possible to call methods that were first defined in the derived class, but what about "overwritten" (don't know the term in C) methods. Is there any way I can access those?
It would be enough to have access to one, overwritten method and then give it instructions to call the other methods.
I thought about instead of registering a pointer to the object, registering a pointer to the new, overwritten method of the object, but that wouldn't help me either. Now I got the method, but it's not linked to the objects data anymore (I assume that every instance of an object uses the same methods defined by it's class and probably hands over a hidden instance pointer in the parameter list, but how do I do that without modifying the compiler (out of question) ?
Hopefully you undestand my question/problem. I probably didn't use the right terms