mirror of
https://github.com/huihut/interview.git
synced 2024-03-22 13:10:48 +08:00
26 lines
502 B
C++
26 lines
502 B
C++
//
|
|
// Created by xiemenghui on 2018/7/21.
|
|
//
|
|
|
|
#ifndef DESIGNPATTERN_CONCRETE_OBSERVER_H
|
|
#define DESIGNPATTERN_CONCRETE_OBSERVER_H
|
|
|
|
#include "observer.h"
|
|
#include <iostream>
|
|
#include <string>
|
|
|
|
class ConcreteObserver : public IObserver
|
|
{
|
|
public:
|
|
ConcreteObserver(std::string name) { m_strName = name; }
|
|
void Update(float price)
|
|
{
|
|
std::cout << m_strName << " - price" << price << "\n";
|
|
}
|
|
|
|
private:
|
|
std::string m_strName; // name
|
|
};
|
|
|
|
#endif //DESIGNPATTERN_CONCRETE_OBSERVER_H
|