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