blob: 580d539558f9b7936de73d239f8387fb8260e020 (
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();
};
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();
// }
};
|