1 00:00:01,930 --> 00:00:08,350 The abstract computer class would have the methods for mounting all the components of a computer and 2 00:00:08,350 --> 00:00:17,560 also a generic method that will call each and every method that is defined here in this class for the 3 00:00:17,560 --> 00:00:24,680 two classes that are inheriting this abstract computer for for the first one for the tower computer. 4 00:00:24,700 --> 00:00:32,770 We don't modify anything because essentially this will this will cover everything that needs to be done 5 00:00:32,770 --> 00:00:34,060 for a tower computer. 6 00:00:34,240 --> 00:00:37,880 However, for the quantum computer, we have a different implementation. 7 00:00:37,900 --> 00:00:42,580 So for the processor and for the cooling, we require some special types. 8 00:00:42,820 --> 00:00:47,760 So we have those overwrites for these two methods. 9 00:00:47,770 --> 00:00:51,180 Over here, the upper class is pretty basic. 10 00:00:51,190 --> 00:00:59,350 So basically we are instantiating and computer for our computer and we build it and we should see all 11 00:00:59,350 --> 00:01:02,740 these systems that print the letters in the console. 12 00:01:03,820 --> 00:01:09,670 However, when we instantiate the same computer as a quantum computer and we call this computer, we 13 00:01:09,670 --> 00:01:15,700 should see the new implementations, the limitations that are specific for this type. 14 00:01:15,970 --> 00:01:17,700 So this is pretty simple. 15 00:01:17,710 --> 00:01:19,450 This is basic inheritance. 16 00:01:19,460 --> 00:01:22,910 So this is what this template method is about. 17 00:01:23,770 --> 00:01:29,210 Of course, this is an overly simplified example, but you can have many, many other examples. 18 00:01:29,230 --> 00:01:34,530 So essentially, this can be used whenever you have such a type of inheritance. 19 00:01:34,540 --> 00:01:43,150 So whenever you can have a basic product that can have some some methods for achieving something, for 20 00:01:43,150 --> 00:01:49,570 achieving an action like building something, building a house, building a computer, any type of object, 21 00:01:49,820 --> 00:01:59,020 and also when you have special flavors for the same types that that can be implemented in subclasses 22 00:01:59,020 --> 00:02:06,800 that can inherit, extend this abstract object and implement their own version of that specific action. 23 00:02:07,060 --> 00:02:08,380 So let's see this in action. 24 00:02:08,390 --> 00:02:09,520 Let's start. 25 00:02:10,850 --> 00:02:18,950 The main method here, so we would expect to see this, which is which is normal for the tower computer, 26 00:02:18,950 --> 00:02:28,940 which doesn't have any any additional method, any additional action or any difference in what is expected 27 00:02:28,940 --> 00:02:30,200 to to be mounted. 28 00:02:30,230 --> 00:02:33,740 What are the components that are expected to be mounted here? 29 00:02:33,980 --> 00:02:39,340 But the quantum computer, however, has to methods like we've seen that are different. 30 00:02:39,500 --> 00:02:45,950 So basically these are the differences between the two computers and those differences are highlighted 31 00:02:46,190 --> 00:02:47,510 in the two subclasses. 32 00:02:48,440 --> 00:02:48,830 All right. 33 00:02:48,840 --> 00:02:54,710 So that's it for this tutorial mean and this one where we are going to discuss about the visitor pattern. 34 00:02:55,100 --> 00:02:59,600 Of course, you can download the code for for this pattern. 35 00:02:59,630 --> 00:03:00,500 You can play with it. 36 00:03:00,500 --> 00:03:08,630 I strongly encourage you to do this because this is the best way to actually get a firm grasp on on 37 00:03:08,630 --> 00:03:09,820 this information. 38 00:03:10,580 --> 00:03:12,560 So see you in a story on.