Here is a concrete minimal example to formulate my question :
In small ball game, you have a physics engine that moves the objects regularly:
void move(set< PhysicalObject* > objets, Duration t)
And that engine can use user defined behaviour when a collision happens (using a strategy class). For instance, default strategy is to update objects directions, but you can provide it with a custom strategy class that kills objects according to some specific rules.
void update_after_collision(DerivedObject* a, DerivedObject* b)
In order to implement new behaviour during a collision, I have some specific derived classes (they have additional attributes/methods corresponding to their lifetime, etc.)
The problem is: the engine calls the update_after_collision strategy, hence I can't use my derived class is this strategy without using a visitor pattern or a type cast. Note that the engine only knows about the base class, not the derived ones.
Is there a way to avoid it? What is the standard approach to look at?
Is another programming paradigm better for this particular case?
EDIT : Code is written in C++