2023-05-04 07:22:06 +00:00
|
|
|
#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 );
|
|
|
|
}
|