class ASubject { //Lets keep a track of all the shops we have observing std::vector<iobserver*> list; public: void Attach(IObserver *product); void Detach(IObserver *product); void Notify(float price); };
class Shop : public IObserver { //Name of the Shop std::string name; float price; public: Shop(std::string n); void Update(float price); ~Shop() { std::cout << " In ~Shop()" << "\n";} };
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)