What all things to do when the subscriber receives such a notification depends on the use-case. The purpose was to notify the application about a document close. But in the previous version presented in Chapter 13, I used basic object pointer (pointer to Application) and a function call back using member function pointer.
In the Document editor, you might have seen that whenever a document is closed, it will notify the application. Its core philosophy is created on a subscription-based notification model, where the observers are the subscribers who are interested in the changes happening in a subject. Observer in simple terms is a contract between two entities called Subject and Observer. In this chapter we will improvise our Application – Document editor using Observer pattern. In previous chapter we saw command behavioral pattern.
how we can improvise our Document editor application with observer pattern.