blob: 39a8245f0ada8343e5fe5bb97852a93fdc66c78e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#include <iostream>
#include "Observer.h"
void Subject::attach(Observer * obs){
// std::cout << "added" << std::endl;
this->observers.push_back(obs);
}
void Subject::detach(Observer *){
}
int Subject::size() {
// std::cout << "subject list size " << this->observers.size() << std::endl;
return this->observers.size();
}
void Subject::notify() {
for (auto observer : this->observers)
observer->update();
}
|