Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Listener
- {
- public:
- virtual void onEvent() = 0;
- }
- class ListenerImplA : public Listener
- {
- private:
- virtual void onEvent() override {printf("hoolayA!");}
- }
- class ListenerImplB : public Listener
- {
- protected:
- virtual void onEvent() override {printf("hoolayB!");}
- }
- void emit(Listener* listener)
- {
- listener->onEvent();
- }
- void main()
- {
- emit(new ListenerImplA);
- emit(new ListenerImplB);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement