30 lines
478 B
C++
30 lines
478 B
C++
// ======================================================
|
|
// Subject.h
|
|
// ======================================================
|
|
|
|
#ifndef SUBJECT_H
|
|
#define SUBJECT_H
|
|
|
|
class Observer;
|
|
|
|
#include <set>
|
|
|
|
class Hint {
|
|
public:
|
|
virtual ~Hint() {}
|
|
};
|
|
|
|
class Subject {
|
|
public:
|
|
typedef std::set<Observer *> ObsList;
|
|
void attach(Observer &obs);
|
|
|
|
protected:
|
|
void notify(const Hint &) const;
|
|
|
|
private:
|
|
ObsList myObservers;
|
|
};
|
|
|
|
#endif
|