forked from EdisonTalk/DesignPattern.Samples.CSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAbstractObjectList.cs
39 lines (33 loc) · 919 Bytes
/
AbstractObjectList.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EDC.DesignPattern.Iterator
{
/// <summary>
/// 抽象聚合类:AbstractObjectList
/// </summary>
public abstract class AbstractObjectList
{
protected IList<object> objectList = new List<object>();
public AbstractObjectList (IList<object> objectList)
{
this.objectList = objectList;
}
public void AddObject(object obj)
{
this.objectList.Add(obj);
}
public void RemoveObject(object obj)
{
this.objectList.Remove(obj);
}
public IList<Object> GetObjectList()
{
return this.objectList;
}
// 声明创建迭代器对象的抽象工厂方法
public abstract AbstractIterator CreateIterator();
}
}