迭代器模式

1】什么是迭代器模式?

【2】迭代器模式代码示例:

代码示例:
#include <iostream>
#include <string>
using namespace std;

class Iterator;

class Aggregate
{
public:
    virtual Iterator *createIterator() = 0;
};

class Iterator
{
public:
    virtual void first() = 0;
    virtual void next() = 0;
    virtual bool isDone() = 0;
};

class ConcreteAggregate : public Iterator
{
public:
    void first()
    {}
    void next()
    {}
    bool isDone()
    {}
};

int main()
{
    return 0;
}

http://www.cnblogs.com/Braveliu/p/3950137.html

posted @ 2015-05-27 22:21  南哥的天下  阅读(108)  评论(0编辑  收藏  举报