aboutsummaryrefslogtreecommitdiff
path: root/Observer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Observer.cpp')
-rw-r--r--Observer.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/Observer.cpp b/Observer.cpp
index ff523b8..39a8245 100644
--- a/Observer.cpp
+++ b/Observer.cpp
@@ -2,12 +2,8 @@
#include "Observer.h"
-void Observer::update(){
- std::cout << 'a' << std::endl;
-}
-
void Subject::attach(Observer * obs){
- std::cout << "added" << std::endl;
+ // std::cout << "added" << std::endl;
this->observers.push_back(obs);
}
@@ -16,13 +12,12 @@ void Subject::detach(Observer *){
}
int Subject::size() {
- std::cout << "subject list size " << this->observers.size() << std::endl;
+ // std::cout << "subject list size " << this->observers.size() << std::endl;
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();
+ for (auto observer : this->observers)
+ observer->update();
}