30 lines
382 B
Plaintext
30 lines
382 B
Plaintext
|
// interface
|
||
|
|
||
|
class Subject
|
||
|
{
|
||
|
public:
|
||
|
virtual void registerObserver() = 0;
|
||
|
virtual void removeObserver() = 0;
|
||
|
virtual void notifyObserver() = 0;
|
||
|
};
|
||
|
|
||
|
class Observer
|
||
|
{
|
||
|
public:
|
||
|
virtual void update() = 0;
|
||
|
};
|
||
|
|
||
|
// classes
|
||
|
|
||
|
class ConcreteSubject : public Subject
|
||
|
{
|
||
|
public:
|
||
|
void getState();
|
||
|
void setState();
|
||
|
};
|
||
|
|
||
|
class ConcreteObserver : public Observer
|
||
|
{
|
||
|
public:
|
||
|
};
|