免费学习该课程!
今天就开通帐号,24,700 门业界名师课程任您挑!
Builder example
- [Instructor] In this exercise, our goal is to build a car object and print its details. We'll do so by using the builder patterns, various participants, including director, abstract builder, concrete builder, and the object being built. The abstract builder class, called builder here, creates a car object and keep it as its attribute. The concrete builder class, called Skylark builder, inherits from the abstract builder class and provides methods to be used by the director class. Let's add one more method to the concrete builder class, which is the add_engine method. So type def add_engine, parentheses, self, colon, type self.car.engine, and set it to "Turbo Engine." The next part is to go back to the director class and complete the definition of the construct_car method. The director object is what actually builds a car. Let's create a new car object to get started. Type self._builder. This attribute is where the concrete builder object is stored, therefore type.create_new_car…
内容
-
-
-
-
(已锁定)
Factory57 秒
-
Factory example7 分钟 37 秒
-
Solution: Factory2 分钟 37 秒
-
(已锁定)
Abstract Factory1 分钟 46 秒
-
(已锁定)
Abstract Factory example5 分钟 57 秒
-
(已锁定)
Singleton1 分钟 39 秒
-
Singleton example7 分钟 17 秒
-
(已锁定)
Solution: Singleton2 分钟 20 秒
-
(已锁定)
Builder2 分钟 3 秒
-
(已锁定)
Builder example5 分钟 59 秒
-
(已锁定)
Prototype1 分钟 30 秒
-
(已锁定)
Prototype example7 分钟 18 秒
-
(已锁定)
-
-
-
-