Lecture overview -- Keyboard shortcut: 'u'  Previous page: A Composite Example: A GUI  -- Keyboard shortcut: 'p'  Next page: Cloning -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home  Page 30 : 41
Object-oriented Programming in C#
Abstract classes, Interfaces, and Patterns
The Observer pattern revisited

It adds flexibility to the Observer pattern if an Observer implements the interface IObserver

 

/user/normark/oop-csharp-1/sources/c-sharp/patterns/observer/weather-info-interfaces/observer.csA WeatherCenter (subject) and Watcher (observer) with interfaces.


/user/normark/oop-csharp-1/sources/c-sharp/patterns/observer/weather-info-interfaces/client.csApplication of the two different Watchers.


/user/normark/oop-csharp-1/sources/c-sharp/patterns/observer/weather-info-interfaces/outputOutput of the WeatherCenter and Watchers application.


The IObserver interface captures the only necessary property of a class that plays the role as an observer