今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Strategy pattern
- [Instructor] The strategy pattern is basically a way to encapsulate different algorithms or functions and then at runtime practically use the same code to run different scenarios. And we've used this approach in some of the code we've written thus far. So let me show you. So basically if you go into the Exercise Files, and either you use 02_03 or the actual files for this video, so 04_06, it's the same thing. So let's go ahead and use that. So I'm going to drag and drop this inside of Visual Studio Code. And you probably recognize this pattern that we've done in video 02_03. So we created a class car with a constructor with doors, engine, and color as arguments, which we prepped with the constructor here. And then we've extended that with the SUV. And then, again, we added the doors, engine, color and then add this wheels of the number of wheels for a SUV. But the strategy pattern is happening right here. So…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
-
-
-
(已锁定)
What are behavioral patterns?1 分钟 4 秒
-
(已锁定)
Observer pattern2 分钟 36 秒
-
(已锁定)
State pattern3 分钟 6 秒
-
(已锁定)
Chain of responsibility1 分钟 30 秒
-
(已锁定)
Iterator pattern3 分钟 44 秒
-
(已锁定)
Strategy pattern1 分钟 36 秒
-
(已锁定)
Memento pattern53 秒
-
(已锁定)
Mediator pattern1 分钟 32 秒
-
(已锁定)
Command pattern2 分钟 24 秒
-
(已锁定)
-