1 00:00:00,590 --> 00:00:06,750 The visitor pattern makes use of a visitor class, which changes the behavior of an element class. 2 00:00:07,790 --> 00:00:13,070 This way, the algorithm choosing for execution can vary when the visitor varies. 3 00:00:14,180 --> 00:00:17,390 This pattern comes under the behavioral pattern category. 4 00:00:18,660 --> 00:00:24,960 As part of the pattern, the element object has to accept the visitor object so that the visitor object 5 00:00:24,960 --> 00:00:27,690 handles the operation on the element object. 6 00:00:28,680 --> 00:00:30,240 Let's have a look in the diagram. 7 00:00:30,420 --> 00:00:36,130 And don't worry if this looks too complex, the visitor pattern is actually really easy to understand. 8 00:00:37,080 --> 00:00:42,270 We can see that we got to interfaces, vehicle part and vehicle part visitor. 9 00:00:43,020 --> 00:00:48,100 The vehicle part is implemented by parts of a vehicle and by the vehicle class as well. 10 00:00:49,350 --> 00:00:51,870 This construct is used for building a new vehicle. 11 00:00:53,000 --> 00:00:58,550 The visitor pattern interface is implemented by a single show, Visitor Concrete Glass, which outputs 12 00:00:58,550 --> 00:01:00,500 the name of each vehicle component. 13 00:01:01,760 --> 00:01:05,620 You can have as many vehicles as you want for any type of action. 14 00:01:06,840 --> 00:01:08,730 Let's see how this looks like in the code.