CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
Hi
I have an alarm and it is blown where either of three boiler's temperature raises above 100 degree.
I tried to do this using reverse observer design pattern (Many to one relationship).
Two queries as below:
1. Is this design okay for this scenario? If not, what is best way to do this implementation?
2. Alarm::update does dynamic cast and could not find a way to get rid off this. How to do so ?
*/
#include <iostream>
#include <list>
using namespace std;
class iObserver;
class iSubject
{
public:
virtual void update(iObserver*) = 0;
virtual ~iSubject() = default;
};
class iObserver
{
public:
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run