-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComponent.cs
More file actions
executable file
·35 lines (32 loc) · 837 Bytes
/
Component.cs
File metadata and controls
executable file
·35 lines (32 loc) · 837 Bytes
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
using System;
using System.Collections.Generic;
namespace CompositePattern
{
public abstract class Component
{
public abstract void Operation(); //Or whathever type.
public virtual void Add(Component component)
{
throw new NotSupportedException("Add is not supported.");
}
public virtual void Remove(Component component)
{
throw new NotSupportedException("Remove is not supported.");
}
public virtual IEnumerable<Component> CreateIterator
{
get
{
return null;
}
}
public string Name
{
get; set;
}
protected Component(string name)
{
this.Name = name;
}
}
}