免费学习该课程!
今天就开通帐号,24,700 门业界名师课程任您挑!
Composite
- [Instructor] The composite design pattern maintains a tree data structure to represent part whole relationships. Here we want to build a recursive tree data structure so that an element of the tree can have its own sub-elements. An example of this problem is creating menu and submenu items. The submenu items can also have their own submenu items. Our coding challenge is to display menu and submenu items using the composite design pattern. Our solution consists of three major elements. The first one is component, the second one is child, and the third one is composite. The component element is an abstract class. A concrete class called child inherits from the component class. And then we have another concrete class called composite, which also inherits from the component class. Finally, our composite class maintains child objects by adding and removing them to and from a tree data structure.
内容
-
-
-
-
-
(已锁定)
Decorator1 分钟 5 秒
-
(已锁定)
Decorator example4 分钟 43 秒
-
(已锁定)
Solution: Decorator1 分钟 55 秒
-
Proxy1 分钟 22 秒
-
(已锁定)
Proxy example5 分钟 23 秒
-
(已锁定)
Adapter48 秒
-
(已锁定)
Adapter example6 分钟 16 秒
-
(已锁定)
Composite1 分钟 21 秒
-
(已锁定)
Composite example5 分钟 25 秒
-
Solution: Composite1 分钟 44 秒
-
(已锁定)
Bridge1 分钟 14 秒
-
(已锁定)
Bridge example5 分钟 31 秒
-
(已锁定)
-
-
-