QtDesignPatterns/observerpattern/interface.h

38 lines
531 B
C
Raw Normal View History

2024-02-06 17:21:37 +08:00
#include <iostream>
using namespace std;
class Observer
{
public:
Observer(){}
virtual ~Observer(){}
virtual void update() = 0;
};
class BinaryObserver: public Observer
{
public:
void update()
{
cout << "BinaryObserver update" << endl;
}
};
class OctalObserver: public Observer
{
public:
void update()
{
cout << "OctalObserver update" << endl;
}
};
class HexaObserver: public Observer
{
public:
void update()
{
cout << "HexaObserver update" << endl;
}
};