A common use for anonymous inner classes in Java is listeners. There is an article about how to write event listener in Java with event adapters http://download.oracle.com/javase/tutorial/uiswing/events/generalrules.html In java98 I think it is called Listener Paradigm. There must be some equivalent listener-style interfaces to be seen in C ++, however, I am not aware of any at this moment. Could anybody please share some knowledge with me about listener-style interfaces in C++? Can I implement an equivalent Listener Paradigm in C++ with event adapters? IS there any sample around by customerizing the OBSERVER pattern? Thanks!
Listener-style Interface in C++
Started by ●October 26, 2010
Reply by ●October 27, 20102010-10-27
like2learn wrote:> A common use for anonymous inner classes in Java is listeners.You should google for "Observer Pattern". C++0x supports lambdas, which is one better than inner classes. You don't need them though, you can just use interfaces (multiply inheritable classes with no variables and no private methods). Now go and do your own homework ;-) Clifford Heath.