场景
站点和仪表目录。
实现代码
组合抽象类:
1 | namespace DesignPatterns.Composite |
站点类
1 | namespace DesignPatterns.Composite |
仪表类
1 | namespace DesignPatterns.Composite |
相关调用
1 | SiteComponent rootSite = new Site("总站"); |
Out:1
2
3
4
5
6
7
8
9
10
11
12-总站
---分站1
-----仪表1
-----仪表2
---分站2
---分站3
---分站4
-----仪表1
-----仪表2
-----仪表3
-----仪表4
-----仪表5