1 00:00:00,960 --> 00:00:06,300 High These are things of the heart once again welcome to the next video of the series of course in fundamentals. 2 00:00:06,430 --> 00:00:11,680 Now in this video of a talk about how do we use the infix function in Gears of Cartland. 3 00:00:11,770 --> 00:00:19,120 So in Cartland we have one word or concept of infix function which is actually the member function or 4 00:00:19,120 --> 00:00:21,710 the extension function in case of Cartland. 5 00:00:22,000 --> 00:00:29,070 So the infix function can be a member function or the extension function and their properties are. 6 00:00:29,140 --> 00:00:31,370 They just contained a single bit. 7 00:00:31,600 --> 00:00:34,900 And they have a prefix of infix. 8 00:00:34,930 --> 00:00:38,890 So let's check out how do we use the infix function in Cartland. 9 00:00:39,010 --> 00:00:42,850 Now in the previous video we talked about the extension function. 10 00:00:42,850 --> 00:00:46,570 So these were all the extension function in case of Cartland. 11 00:00:46,780 --> 00:00:54,430 Now suppose I said the infix function all in fixed function or extension function but all extension 12 00:00:54,430 --> 00:00:59,750 functions are not infix function which means that here I have to extension function. 13 00:00:59,800 --> 00:01:04,770 So it is not necessary that these two can be declared as the infix function. 14 00:01:04,780 --> 00:01:05,720 What I am saying is. 15 00:01:05,710 --> 00:01:12,160 Suppose if I use the prefix of infix And here again infix. 16 00:01:12,340 --> 00:01:15,950 So here you can notice this Metford did not show any error. 17 00:01:16,210 --> 00:01:18,520 But this method is showing some error. 18 00:01:18,580 --> 00:01:19,790 Let's figure it out. 19 00:01:19,790 --> 00:01:26,610 It says that the infix Mortified is inapplicable on this function because this function has stupid ammeters 20 00:01:26,830 --> 00:01:32,490 and it is the property of the infix function and they should only contain one paramita. 21 00:01:32,500 --> 00:01:33,320 Right. 22 00:01:33,340 --> 00:01:36,970 So this method is now the infix in nature. 23 00:01:37,000 --> 00:01:45,160 So there doesn't need a command line you can call it infix function and also you can call it extension 24 00:01:45,190 --> 00:01:45,940 function. 25 00:01:46,830 --> 00:01:47,340 Right. 26 00:01:47,550 --> 00:01:52,840 But this method can only be extension functions not the infix function. 27 00:01:52,860 --> 00:01:55,320 So we have to remove this infix keyword. 28 00:01:55,320 --> 00:01:56,130 Right. 29 00:01:56,130 --> 00:01:57,820 So here let us remove it. 30 00:01:57,840 --> 00:02:01,590 As of now because this video is about the infix function right. 31 00:02:01,590 --> 00:02:02,960 So it doesn't move it. 32 00:02:03,390 --> 00:02:06,750 And always remember the infix function only going down one parameter. 33 00:02:06,780 --> 00:02:10,080 So that's why I remove that mattered. 34 00:02:10,080 --> 00:02:14,030 And now at the top layer doesn't it move these string lines. 35 00:02:14,070 --> 00:02:17,590 Right now I suppose if I add in the code right now then. 36 00:02:17,640 --> 00:02:22,110 Then also we will get the same output as we got in the previous value. 37 00:02:22,500 --> 00:02:23,400 So let's check it out. 38 00:02:23,400 --> 00:02:24,300 So here we go. 39 00:02:24,320 --> 00:02:24,660 Good. 40 00:02:24,700 --> 00:02:25,860 Then as the output. 41 00:02:26,010 --> 00:02:31,060 So with or without the infix key word Our code is again working perfectly fine. 42 00:02:31,070 --> 00:02:32,560 Later check it out again. 43 00:02:32,760 --> 00:02:34,130 Let's verify it. 44 00:02:37,400 --> 00:02:39,690 So there we go again we get 10. 45 00:02:39,830 --> 00:02:44,630 Now you must be thinking What is the benefit of using the infix keyword. 46 00:02:44,630 --> 00:02:50,850 Why don't we simply use the extension function as a plain function and just move on. 47 00:02:50,900 --> 00:02:57,590 Right but the thing is that if you use the infix keyword here then while calling the function such as 48 00:02:57,590 --> 00:03:04,940 the reader value you can simply call X space greater value and then simply give a space. 49 00:03:04,940 --> 00:03:10,980 Now this is the usage of the infix function you can simply use X space greater value space like. 50 00:03:11,180 --> 00:03:15,770 And this method will be triggered present inside this file. 51 00:03:15,870 --> 00:03:22,130 Right but if you make it just the extension function then this syntax will not be applicable. 52 00:03:22,130 --> 00:03:24,330 Now Dom would benefit of the infix function. 53 00:03:24,430 --> 00:03:28,150 Check it out in our operator overloading which we will go with. 54 00:03:28,150 --> 00:03:29,660 In our upcoming voodoos. 55 00:03:29,690 --> 00:03:30,110 Right. 56 00:03:30,110 --> 00:03:33,670 So as of now let us run the code. 57 00:03:33,770 --> 00:03:34,820 So here we go. 58 00:03:34,910 --> 00:03:36,420 Then again in the output. 59 00:03:36,560 --> 00:03:40,430 So the infix function also increases the readability of the code. 60 00:03:40,460 --> 00:03:41,300 Right. 61 00:03:41,390 --> 00:03:48,050 So at the end you can see X greater value Y is actually the same as X and d'arte greater value. 62 00:03:48,170 --> 00:03:49,910 So both are exactly the same. 63 00:03:50,000 --> 00:03:50,910 Now and the end. 64 00:03:50,920 --> 00:03:56,870 Let us again summarize the properties of the infix function that they just have one parameter and all 65 00:03:56,870 --> 00:04:03,020 infix function or extension function but all extension function cannot be the infix function. 66 00:04:03,020 --> 00:04:03,680 Right. 67 00:04:03,740 --> 00:04:05,140 So let us know in the video. 68 00:04:05,150 --> 00:04:09,830 And guys you guys in the next video there's a shooting at the hard signing off and have a good day. 69 00:04:09,830 --> 00:04:10,340 Thank you.