首页 > 其他 > 详细

迭代器模式

时间:2015-05-28 00:29:13      阅读:237      评论:0      收藏:0      [点我收藏+]
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

迭代器模式

原文:http://www.cnblogs.com/leijiangtao/p/4534574.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!