Of course it depends on the situation. But when a lower level object or system communicate with an higher level system, should callbacks or events be preferred to keeping a pointer to the higher level object?
For example, if we are working on a game, we have a world class
that has a member variable vector<monster> monsters
. When the monster class
is going to communicate with the world class
, should I prefer using a callback function then or should I have a pointer to the world class inside the monster class?