How
- The Observer-interface: All observers must implement this interface: So they all have a Notify-method.
- The observable base-class: Keeps track of all the observer-objects (reference to their Observer-interface)
- Your observable class will inherit from the observable baseclass. This class will thus inherit the behaviour that manages and notifies the observers. When needed, you just call NotifyObservers().
- Your observers will implement the Observer-interface, so their Notify-method can be called by the Observable class.
- Pass an object with all the data via the Notify-methods
- The observer gets the data via the properties of the observable-object
Geen opmerkingen:
Een reactie posten