Of course, it depends on the situation. But when an object or system of a lower level interacts with a system of a higher level, should callbacks or events be preferred to maintain a pointer to a higher level object?
For example, if we are working on a game, we have world classone that has a member variable vector<monster> monsters. When monster classwill it interact with world class, should I use the callback function, or should I have a pointer to the world class inside the monster class?
source
share