File tree Expand file tree Collapse file tree 3 files changed +13
-12
lines changed Expand file tree Collapse file tree 3 files changed +13
-12
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace Composite
4
4
{
5
- public class Boxs : Component
5
+ public class Boxs : Component , IComposite
6
6
{
7
7
protected List < Component > _children = new List < Component > ( ) ;
8
8
9
- public override void Add ( Component component )
9
+ public void Add ( Component component )
10
10
{
11
11
this . _children . Add ( component ) ;
12
12
}
13
13
14
- public override void Remove ( Component component )
14
+ public void Remove ( Component component )
15
15
{
16
16
this . _children . Remove ( component ) ;
17
17
}
Original file line number Diff line number Diff line change @@ -7,15 +7,7 @@ public abstract class Component
7
7
8
8
public abstract string Operation ( ) ;
9
9
10
- public virtual void Add ( Component component )
11
- {
12
- throw new NotImplementedException ( ) ;
13
- }
14
-
15
- public virtual void Remove ( Component component )
16
- {
17
- throw new NotImplementedException ( ) ;
18
- }
10
+
19
11
20
12
public virtual bool IsComposite ( )
21
13
{
Original file line number Diff line number Diff line change
1
+ namespace Composite
2
+ {
3
+ public interface IComposite
4
+ {
5
+ void Add ( Component component ) ;
6
+
7
+ void Remove ( Component component ) ;
8
+ }
9
+ }
You can’t perform that action at this time.
0 commit comments