C++ 观察者模式 (Oberver Pattern)

由于是个人练习用的,而且时间仓促,没有想好后再来写,尽请见谅!

//UtilTool.h

#pragma once
#include <iostream>
#include <string>
#include <list>

using namespace std;

//Event.h

#pragma once
#include "UtilTool.h"
enum EVENT_STATE
{
    EAWAKE = 0,
    ESTART = 1,
    ETICK = 2,
    EEND = 3,
    ELEAVE = 4,
    EDESTROY = 5,
    ENORMAL = 6,
    ECLICK =7,
    EOVERLAP =8
};
class Event
{
public:
    Event() :mCurrentState(EVENT_STATE::EAWAKE) {}
    virtual void Awake() { cout << "This is basic awake!"<<endl; };
    virtual void Start() { cout << "This is basic start!"<<endl; };
    virtual void Tick() { cout << "This is basic tick!"<<endl; };
    virtual void End() { cout << "This is basic end!"<<endl; };
    virtual void Overlap() { cout << "This is basic overlap!"<<endl; };
    virtual void Destroy() { cout << "This is basic destroy!"<<endl; };
    EVENT_STATE mCurrentState;
};

//Object.h

#pragma once
#include "UtilTool.h"
#include "Eve

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值