blob: 7d5dc22bb5a141b43de0d30e3345f4f7c05e4b83 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#include <iostream>
#include "Observer.h"
void Subject::attach(Observer * obs){
this->observers.push_back(obs);
}
void Subject::detach(Observer *){
}
int Subject::size() {
return this->observers.size();
}
// TODO possibly add foo input as update value?
void Subject::notify() {
for (int i = 0; i < this->observers.size(); i++)
this->observers[i]->update();
}
|