blob: 20ca887868da6f58b48e836e36b3e30fa4b74770 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#pragma once
#include <vector>
class Observer {
public:
virtual void update() = 0;
};
class Subject {
private:
std::vector<Observer*> observers;
public:
// virtual void attach(Observer* obs) { observers.push_back(obs);}
virtual void attach(Observer* obs);
virtual void detach(Observer*);
virtual int size();
virtual void notify();
};
|