Page 18 : 20
Object-oriented Programming in C#
Operators, Delegates, and Events
* Overloaded Operators
Why operator overloading?
Overloadable operators in C#
An example of overloaded operators: Interval
Some details of operator overloading
* Delegates
Delegates in C#
Delegates that contain instance methods
Multivalued delegates
Lambda Expressions
* Events
Events
Events in C#
Examples of events
* Patterns and Techniques
Motivation - Example
The observer design pattern
An Observer Example
Observer with Delegates and Events
Observer Example with Delegates and Events
An Observer Example
We show the concrete programs that implement observer in the weather center scenario.
A WeatherCenter (subject) and TemperatureWatcher (observer).
Application of the WeatherCenter and TemperatureWatcher.
Output of the WeatherCenter and TemperatureWatcher application.
It would be useful if a number of different classes could act as observers
Observer