Advertisement
Guest User

Untitled

a guest
Sep 26th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. class Listener
  2. {
  3. public:
  4. virtual void onEvent() = 0;
  5. }
  6.  
  7. class ListenerImplA : public Listener
  8. {
  9. private:
  10. virtual void onEvent() override {printf("hoolayA!");}
  11. }
  12.  
  13. class ListenerImplB : public Listener
  14. {
  15. protected:
  16. virtual void onEvent() override {printf("hoolayB!");}
  17. }
  18.  
  19. void emit(Listener* listener)
  20. {
  21. listener->onEvent();
  22. }
  23.  
  24. void main()
  25. {
  26. emit(new ListenerImplA);
  27. emit(new ListenerImplB);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement