1 Star 0 Fork 621

zhangzslab/DesignPattern

forked from Micooz/DesignPattern 
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Aggregate.cpp 556 Bytes
一键复制 编辑 原始数据 按行查看 历史
Micooz 提交于 2014-10-09 11:46 +08:00 . 加入解释器模式,迭代器模式
#include <iostream>
using namespace std;
#include "Aggregate.h"
#include "Iterator.h"
Aggregate::Aggregate() {
}
Aggregate::~Aggregate() {
}
ConcreteAggreaget::ConcreteAggreaget() {
for (int i = 0; i < SIZE; i++) {
_objs[i] = i;
}
}
//Iterator* ConcreteAggreaget::CreateIterator() {
// return new ConcreteIterator(this);
//}
Object ConcreteAggreaget::GetItem(int idx) {
if (idx < this->GetSize()) {
return _objs[idx];
}
else {
return -1;
}
}
int ConcreteAggreaget::GetSize() {
return SIZE;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/a20182018/DesignPattern.git
git@gitee.com:a20182018/DesignPattern.git
a20182018
DesignPattern
DesignPattern
master

搜索帮助