First of all, I know that there are excellent implementations (Qt, Boost, cpp-event, etc.), but I ask the question because I want to know how it works!
If I understand correctly, the "event system" uses the Observer pattern: some objects observe, expecting something to happen ... and some others will send signals. Good.
So, let's say I have my class of observers, with these things:
void Observer::getNotified()
{
}
My question is: how to manage dynamically, what things need to be done? I saw a lot of people speaking specifically so as not to use function pointers. For my current need, I can make a switch statement, an enumeration type and select different types of behavior, but this is not very satisfactory. So, if it doesn't work with pointers, how is it done?
source
share