CPP Code Demo1: video player play decode

#include <iostream>
using namespace std;

// 纯虚类及其子类 共同服务于第三类(此类是业务应用层概念, 前者是底层逻辑概念)
struct IDecode {
    virtual bool Decode(const char* data, size_t size) = 0;
    virtual ~IDecode() {}
};

struct MP4Decode : public IDecode {
    bool Decode(const char* data, size_t size) {
        //todo
        return true;
    }
    ~MP4Decode() {}
};

struct AVIDecode : public IDecode {
    bool Decode(const char* data, size_t size) {
        //todo
        return true;
    }
    ~AVIDecode() {}
};

struct Player {
    Player(IDecode* de) : decode(de) {}
    ~Player() {}
    bool Play(const char* data, size_t size) {
        if (decode->Decode(data, size)) {
            cout << "Decode Success, Start Play..." << endl;
            // to play
        }
        else {
            cout << "Decode Failed, Stop Play..." << endl;
        }
    }
private:
    IDecode* decode;
};