aboutsummaryrefslogtreecommitdiff
path: root/Observer.h
blob: 7b2db7e38d1b4ab5e50043f6cc082d6b7d33c6a0 (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() { return this->observers.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();
	// }
};