DesignPattern/17.IteratorPattern/2.Code/Aggregate.h

34 lines
577 B
C
Raw Normal View History

2019-11-03 06:20:17 +00:00
#ifndef __AGGREGATE_H__
#define __AGGREGATE_H__
#include <vector>
using namespace std;
// ǰ<><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E0BBA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
class Iterator;
class RemoteControl;
// <20><><EFBFBD><EFBFBD><EFBFBD>ۺ<EFBFBD><DBBA><EFBFBD> Aggregate
class Aggregate
{
public:
Aggregate(){}
virtual Iterator* createIterator() = 0;
};
// <20><><EFBFBD><EFBFBD><EFBFBD>ۺ<EFBFBD><DBBA><EFBFBD> Television
class Television :public Aggregate
{
public:
Television();
Television(vector<string> iChannelList);
// ʵ<>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Iterator* createIterator();
// <20><>ȡ<EFBFBD>ܵ<EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>Ŀ
int getTotalChannelNum();
void play(int i);
private:
vector<string> channelList;
};
#endif //__AGGREGATE_H__