SWADP/Opdracht_2/Observer.cpp

13 lines
266 B
C++
Raw Permalink Normal View History

#include "Observer.h"
2023-04-28 11:36:57 +00:00
void Subject::notify ( ){
for ( list<Observer*>::iterator i=L.begin( ); i!=L.end( ); ++i ) (*i)->update( );
}
Observer::Observer ( Subject* s ) : S(s){
getSubject( )->insert(this);
}
Observer::~Observer ( ){
getSubject( )->remove ( this );
}