blob: 0661bf05aeab293c195d4ce61d57b960b0b56cd1 (
plain)
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
|
#pragma once
#include <vector>
class Observer {
private:
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();
// TODO possibly add foo input as update value?
virtual void notify();
// virtual void notify() {
// for (int i = 0; i < observers.size(); i++)
// observers.at(i)->update();
// }
};
|