1 00:00:00,060 --> 00:00:06,570 Now we can move to next topic or this binder, so this binder is something which we use to hold the 2 00:00:06,570 --> 00:00:07,890 address of current object. 3 00:00:07,920 --> 00:00:11,100 So suppose we want to access something inside a class. 4 00:00:11,100 --> 00:00:16,320 You need to call that address of that particular current object, which is in action right for that 5 00:00:16,320 --> 00:00:18,120 purpose we use in this binder. 6 00:00:18,300 --> 00:00:20,120 So let's see a quick demo. 7 00:00:20,120 --> 00:00:20,970 What this is all about. 8 00:00:20,970 --> 00:00:26,860 The demo theory is not much important, so we can go to this point US program here, right? 9 00:00:27,240 --> 00:00:29,130 Opiod able to see it. 10 00:00:29,640 --> 00:00:33,390 Now, if you look into this program, there is nothing much to see. 11 00:00:33,420 --> 00:00:35,610 There's a class named demo created. 12 00:00:35,610 --> 00:00:40,560 It's having private access to labor and I'm getting to where it was number. 13 00:00:40,560 --> 00:00:44,590 And see, it's created for that and we have a public access. 14 00:00:44,590 --> 00:00:45,240 Specify it. 15 00:00:45,330 --> 00:00:50,650 Then I'm writing my function inside that class in that case, so you can write the function. 16 00:00:50,680 --> 00:00:53,420 Also, you can define it inside a class. 17 00:00:53,430 --> 00:00:55,200 So this index is very simple. 18 00:00:55,380 --> 00:00:57,330 You can use this index for the function. 19 00:00:57,330 --> 00:01:01,770 Again, write this index and you can start the definition of the function, how you can access this 20 00:01:01,770 --> 00:01:03,690 function object of that class. 21 00:01:03,690 --> 00:01:05,340 Not set my values. 22 00:01:05,370 --> 00:01:05,850 OK. 23 00:01:05,880 --> 00:01:08,780 And that's all things seen with respect to functions. 24 00:01:08,790 --> 00:01:10,530 And here what I'm doing. 25 00:01:10,650 --> 00:01:12,500 whoI set my values. 26 00:01:12,510 --> 00:01:14,010 I'm creating that function. 27 00:01:14,040 --> 00:01:19,500 It will have ability to get to arguments that is numb and see it. 28 00:01:19,500 --> 00:01:21,060 And it's showing this. 29 00:01:21,060 --> 00:01:22,750 I don't know, I'm equal to. 30 00:01:23,070 --> 00:01:27,970 So, you know, here, this is that this point I was talking about why it's using that. 31 00:01:27,990 --> 00:01:36,150 Because this num and see it's private variables, as you have learned in the previous section of access 32 00:01:36,150 --> 00:01:42,810 specify it's private variable scan or the variables which comes under the private access label can be 33 00:01:42,810 --> 00:01:44,850 or lean's access inside the class. 34 00:01:44,880 --> 00:01:49,620 So we are trying to access this node and this see, it's inside this class itself. 35 00:01:49,680 --> 00:01:54,850 So this bind us sees this dark number to know this darkness. 36 00:01:54,880 --> 00:01:57,570 That means this one equals to number. 37 00:01:57,690 --> 00:02:03,600 That means this what you are getting, that this is that dual variable with just local to the function 38 00:02:03,630 --> 00:02:04,020 number. 39 00:02:04,050 --> 00:02:10,650 And see, it's and it's like, this is that two variables inside the glass more that having the same 40 00:02:10,650 --> 00:02:10,920 name. 41 00:02:11,100 --> 00:02:13,120 How we can differentiate that. 42 00:02:13,140 --> 00:02:15,320 So this keyword is used for that. 43 00:02:15,330 --> 00:02:21,620 So this behind us says that this number will be the number which is defined for that class. 44 00:02:21,630 --> 00:02:26,550 And without this number, it means like the local variables for the function. 45 00:02:26,580 --> 00:02:28,560 So it's very simple. 46 00:02:28,770 --> 00:02:33,630 Even that Visual Studio code is showing that this c the example. 47 00:02:33,630 --> 00:02:37,610 If you are clicking on this dark number, it is actually highlighting this one, right? 48 00:02:37,620 --> 00:02:40,530 And if you are creating on this note, it's highlighting this one. 49 00:02:40,590 --> 00:02:42,460 So you can differentiate What is this? 50 00:02:42,480 --> 00:02:46,790 I don't operate that a number and this ad override that see, it's more different. 51 00:02:46,800 --> 00:02:49,800 This is winding to this and this is why into this. 52 00:02:49,890 --> 00:02:54,320 So this binder will be pointing to the current class. 53 00:02:54,330 --> 00:03:00,870 And if you are using this behind it, it will get the current class variables or functions. 54 00:03:00,900 --> 00:03:04,500 OK, now another function is return for displaying the values. 55 00:03:04,500 --> 00:03:07,900 It's straightforward, and now we are going to the main function. 56 00:03:07,920 --> 00:03:13,450 Yeah, creating the object for the more class we are setting values of object with hundred and eight. 57 00:03:13,470 --> 00:03:14,250 So what happened? 58 00:03:14,400 --> 00:03:21,780 Object named dock function name will guide this function or here it will pass and led to here and to 59 00:03:21,780 --> 00:03:24,490 hear what happened to the next step. 60 00:03:24,510 --> 00:03:32,250 That object, our demo object, it's the become the value from here and objects associates will become 61 00:03:32,250 --> 00:03:33,240 the value from here. 62 00:03:33,270 --> 00:03:33,840 So that's it. 63 00:03:33,840 --> 00:03:40,950 And I am granting that display values just getting that values from the class or object and just printing 64 00:03:40,950 --> 00:03:41,280 it out. 65 00:03:41,280 --> 00:03:44,510 It's a straightforward function, just use for printing them out. 66 00:03:44,730 --> 00:03:46,380 Now we can just run this. 67 00:03:46,500 --> 00:03:50,790 So C++, this b dog. 68 00:03:51,630 --> 00:03:53,990 No, I'm going to run this. 69 00:03:54,000 --> 00:03:59,310 I have compiled or slash it out, and I am going to send this very straightforward. 70 00:03:59,370 --> 00:04:00,990 It's showing a hundred and eight. 71 00:04:01,110 --> 00:04:01,560 That's it. 72 00:04:01,560 --> 00:04:02,160 That's down. 73 00:04:02,610 --> 00:04:06,540 OK, now let's go back to our PowerPoint next stop. 74 00:04:06,540 --> 00:04:09,450 Biggest private functions and friend classes. 75 00:04:09,600 --> 00:04:14,730 So you have already we have seen this thing right, how we can use access. 76 00:04:14,730 --> 00:04:21,570 Specify this and this point, and you have a conclusion that how you can access the private and protected 77 00:04:21,570 --> 00:04:28,850 data members of the class because you need to always access the data private data also right? 78 00:04:28,860 --> 00:04:35,160 If even if that data is declared as limited or under private access label, it should be accessed. 79 00:04:35,160 --> 00:04:38,580 If there is no access outside the class, there is no meaning. 80 00:04:38,640 --> 00:04:38,940 Right? 81 00:04:39,030 --> 00:04:46,980 So in order to overcome the limited private members not being accessed outside the class, we will use 82 00:04:46,990 --> 00:04:51,840 that concept art, front function and free classes model for same purpose. 83 00:04:51,900 --> 00:04:59,100 We declare private function inside a class so that the private and protected data members of a class 84 00:04:59,100 --> 00:04:59,580 can be. 85 00:04:59,970 --> 00:05:07,080 Sensed and seen that Israel is in a uniquely reckless and inside that you will name that function by 86 00:05:07,170 --> 00:05:13,830 you and your psyche, you are right this keyword for like your friend will be used to make that function 87 00:05:14,040 --> 00:05:14,730 from function. 88 00:05:14,760 --> 00:05:18,320 So how that you see here, you have an example. 89 00:05:18,390 --> 00:05:19,230 Clear example. 90 00:05:19,290 --> 00:05:20,940 So we have a glass glass. 91 00:05:21,660 --> 00:05:24,130 So this is about creating a frame glass. 92 00:05:24,690 --> 00:05:30,930 So if you want to create a Class B, which is a premium glass of air, you have to redefine Li. 93 00:05:30,930 --> 00:05:35,520 Like you have to make the compiler understand that the glass beads are already dead. 94 00:05:35,520 --> 00:05:38,030 So that's why we are declaring glass glass. 95 00:05:38,050 --> 00:05:38,580 Be here. 96 00:05:38,610 --> 00:05:40,260 Then we are creating glass. 97 00:05:40,770 --> 00:05:43,900 Then you have to say like Frank Glass be. 98 00:05:43,920 --> 00:05:45,980 This just means like glass. 99 00:05:45,990 --> 00:05:48,630 We will be glass glass. 100 00:05:48,990 --> 00:05:50,790 Then you will define that glass. 101 00:05:51,060 --> 00:05:59,220 So if you declared that Cosby asked, the glass is then glass, we will have access to all that data 102 00:05:59,220 --> 00:06:01,110 members and fountains of that blast. 103 00:06:01,350 --> 00:06:03,690 So these are like two different topics. 104 00:06:03,960 --> 00:06:06,410 One is brain function and Frank Glass. 105 00:06:06,480 --> 00:06:08,700 So both are similar framing function. 106 00:06:08,700 --> 00:06:14,790 If you declare a function as a friend to a glass that function, we have access to that glass, private 107 00:06:14,790 --> 00:06:15,640 and protected data. 108 00:06:16,230 --> 00:06:22,320 Similarly, if you declare glass front line of that glass, the front glass will have access to that 109 00:06:22,560 --> 00:06:26,580 all that private and protected data members of that particular class. 110 00:06:26,640 --> 00:06:28,380 Now let's jump to that demo. 111 00:06:28,800 --> 00:06:32,260 So here we have the example of frank functions. 112 00:06:32,280 --> 00:06:36,580 So you can see I have a glass name distance and it's having a data. 113 00:06:36,750 --> 00:06:39,020 This is the part where you have to focus. 114 00:06:39,030 --> 00:06:43,660 It's having a variable card meter, which is declared as private. 115 00:06:43,680 --> 00:06:49,370 So there is no way to access this variable meter outside this glass because it will be throwing out 116 00:06:49,380 --> 00:06:49,830 an error. 117 00:06:49,860 --> 00:06:52,560 So what I am doing, I'm creating a program function. 118 00:06:52,650 --> 00:06:56,340 So Edison brings the function declaration form and should be there. 119 00:06:56,340 --> 00:07:00,960 Along with that, you will be saying upfront from keyboard in front of that. 120 00:07:00,990 --> 00:07:06,990 So it will become a function, then I'm having a public glass distance meter of zero. 121 00:07:07,230 --> 00:07:10,650 This is actually I can stick to this topic. 122 00:07:10,650 --> 00:07:13,230 We will be covering later so you can enter this one. 123 00:07:13,410 --> 00:07:14,700 You can just focus on here. 124 00:07:14,910 --> 00:07:18,240 So I'm trying to create that definition of different function. 125 00:07:18,240 --> 00:07:19,680 Add five distance. 126 00:07:19,680 --> 00:07:22,890 The exact five is that foreign function. 127 00:07:22,950 --> 00:07:25,800 So it's able to access that meter. 128 00:07:25,980 --> 00:07:26,370 OK. 129 00:07:26,400 --> 00:07:31,590 He told me that it will not any add up because this is our different class of our class. 130 00:07:31,590 --> 00:07:34,410 So differently that is possible plus equal to five. 131 00:07:34,440 --> 00:07:35,580 What does this mean? 132 00:07:35,580 --> 00:07:41,090 Speed dog meat recall two plus equal to five means be dark meat less white. 133 00:07:41,110 --> 00:07:45,000 That means adding the value five to the may be dark meat. 134 00:07:45,180 --> 00:07:48,480 So what is the current value which is inside this meat? 135 00:07:48,810 --> 00:07:49,530 It will be. 136 00:07:49,530 --> 00:07:53,460 This function will be adding five to that, then returned dark meat. 137 00:07:53,580 --> 00:07:58,650 So now here we are declaring distance D. So you can see this stems made of zero. 138 00:07:58,680 --> 00:08:01,720 This means that the value of meat will be set to zero. 139 00:08:01,740 --> 00:08:06,600 So this is that I'm stricter and stricter will set the value of me down to zero. 140 00:08:06,640 --> 00:08:08,820 And second, we will study in detail. 141 00:08:08,880 --> 00:08:11,660 But no, you just need to understand this. 142 00:08:11,670 --> 00:08:17,920 This statement will make that value meter of the object being created out here equal to zero. 143 00:08:17,940 --> 00:08:20,280 So see at our press maybe three to five that we know. 144 00:08:20,280 --> 00:08:28,380 So what happens when you can't add five of B and five will be actually sending out the value of that 145 00:08:28,380 --> 00:08:30,750 object inside my friend function. 146 00:08:31,050 --> 00:08:38,460 So it will accept that object inside my private function and it will access dot meter plus equal to 147 00:08:38,460 --> 00:08:42,060 fight, which means it will add the value of meter plus frame. 148 00:08:42,060 --> 00:08:45,330 So current value of meter is zero and it will add five. 149 00:08:45,450 --> 00:08:47,770 So it will be then so will be quite so. 150 00:08:47,770 --> 00:08:49,950 We are counting that and try it again. 151 00:08:50,100 --> 00:08:52,410 Let's see this in action again. 152 00:08:52,590 --> 00:08:59,870 Plus plus key word from func not see now, not slash and outright fire. 153 00:08:59,880 --> 00:09:02,160 So you have some confusion here, right? 154 00:09:02,340 --> 00:09:04,890 So let me show this just to zero. 155 00:09:05,250 --> 00:09:11,180 The current value of media when that object was created was zero because yet I have lost that value. 156 00:09:11,250 --> 00:09:16,800 So let me put it, despite what happens to this program, you can see that so five and I have asked 157 00:09:16,800 --> 00:09:19,950 that act function by function would be executed. 158 00:09:20,250 --> 00:09:21,390 So if I will be there? 159 00:09:21,600 --> 00:09:22,680 Now what happens? 160 00:09:22,890 --> 00:09:27,540 You can predict output comparing and then bringing that was centered 10, right? 161 00:09:27,720 --> 00:09:29,520 Because here the value was five. 162 00:09:29,550 --> 00:09:32,390 Then you have add five to that value it become. 163 00:09:32,430 --> 00:09:39,680 And the point is we have ability to access that private, private data member that is meter from the 164 00:09:39,690 --> 00:09:40,860 front function. 165 00:09:40,880 --> 00:09:43,200 So that's why we use that function.