aboutsummaryrefslogtreecommitdiff
path: root/Observer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Observer.cpp')
-rw-r--r--Observer.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Observer.cpp b/Observer.cpp
index 1d96ed4..d2a1062 100644
--- a/Observer.cpp
+++ b/Observer.cpp
@@ -5,6 +5,7 @@ void Observer::update(){
std::cout << 'a' << std::endl;
}
+
void Subject::attach(Observer* obs){
std::cout << "added" << std::endl;
this->observers.push_back(obs);
@@ -14,6 +15,11 @@ void Subject::detach(Observer*){
}
+int Subject::size() {
+ 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++)