

C++ Event Listener Design Pattern - EGreg
http://www.flipcode.com/archives/Theory_Practice-Issue_06_Event_Handling_Model.shtml

======
QuadDamaged
The ClassID trick is reminiscent of ObjC's KVO
addObserver:forKeyPath:options:context: - you typically pass a context to
sort-out which type of object you are observing, because the observer only has
one entry point for KVO notification.

static void* kFooContext= &kFooContext

... [foo addObserver:self forKeyPath:@"bar" options:... context:kFooContext ]
...

if(context==kFooContext){ NSFoo* foo=(NSFoo*)object;... }

A better alternative is to use a blocks/lambda based approach, that way you
can have several distinct callbacks and don't have to handle routing yourself.
(see Facebook KVOController)

