1 Star 0 Fork 621

popey/DesignPattern

Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
Aggregate.cpp 556 Bytes
Copy Edit Raw Blame History
Micooz authored 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/popey/DesignPattern.git
git@gitee.com:popey/DesignPattern.git
popey
DesignPattern
DesignPattern
master

Search