This repository has been archived on 2022-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
patterns/observer/app.d

18 lines
599 B
D

module observer.app;
import observer.weatherdata;
import observer.currentconditionsdisplay;
import observer.heatindexdisplay;
void main()
{
WeatherData weatherData = new WeatherData();
CurrentConditionsDisplay currentDisplay = new CurrentConditionsDisplay(weatherData);
HeatIndexDisplay heatIndexDisplay = new HeatIndexDisplay(weatherData);
weatherData.setMeasurements(80, 65, 30.4f);
weatherData.setMeasurements(82, 70, 29.2f);
weatherData.removeObserver(heatIndexDisplay);
weatherData.setMeasurements(78, 90, 29.2f);
weatherData.setMeasurements(81, 72, 29.5f);
}