1 00:00:02,980 --> 00:00:09,100 Ed Glass, Gardner, Glass, be so what I want to inherit a glass, be from glass and my index should 2 00:00:09,100 --> 00:00:12,780 be like this glass be then the box. 3 00:00:12,790 --> 00:00:16,930 After that, you will give the access, specify which will be public. 4 00:00:17,020 --> 00:00:22,860 Then the base glass May eight, then you have to give that box and start writing that glass b. 5 00:00:22,880 --> 00:00:26,320 Then you can put that braces end and semicolon. 6 00:00:26,350 --> 00:00:32,220 So it's very similar to inherit all that like functions and variables from A to B. 7 00:00:32,230 --> 00:00:33,880 Just follow this syntax. 8 00:00:33,910 --> 00:00:37,690 OK, now let's see what is the public here mean? 9 00:00:38,080 --> 00:00:40,440 So the public use and access specify it. 10 00:00:40,630 --> 00:00:48,010 OK, so if we want to derive a subclass from a public base class, then the public members of the base 11 00:00:48,010 --> 00:00:53,440 class will become public into the right class, and protected members of the base class will become 12 00:00:53,440 --> 00:00:56,140 that protected members in that drive class. 13 00:00:56,350 --> 00:01:01,000 So we are inheriting something or that class, OK in public law. 14 00:01:01,300 --> 00:01:05,280 We do have to specify s defining, say, the class right. 15 00:01:05,290 --> 00:01:12,070 We have a public God protected our private members in senior class public members that will go to the 16 00:01:12,070 --> 00:01:13,250 public section of that. 17 00:01:13,550 --> 00:01:20,380 IRA Glass, suppose I am having Class E and it's having a lot of public members last year and it's having 18 00:01:20,380 --> 00:01:21,820 a lot of public members. 19 00:01:21,850 --> 00:01:26,550 A, b c, the public members let it be elements for functions, whatever. 20 00:01:26,560 --> 00:01:34,510 If that is inherited to Class B in this public, more than public Class B will contain A and B and C 21 00:01:34,510 --> 00:01:35,520 and that it's public. 22 00:01:35,530 --> 00:01:36,850 OK, so that's it all. 23 00:01:36,850 --> 00:01:42,670 The public must be always going public to that class, speak from me and the disinherited in public. 24 00:01:42,890 --> 00:01:47,680 And if it just having any protective gear must, that will be going to that protected session right 25 00:01:47,680 --> 00:01:52,480 then in protecting the public member and protecting members will be protected. 26 00:01:52,480 --> 00:01:54,880 Everything should really be going to that protected. 27 00:01:55,090 --> 00:02:01,210 And if it is in private, more every members of that protected and public and private, all members 28 00:02:01,210 --> 00:02:04,790 will go to that walk private mode in that class. 29 00:02:04,810 --> 00:02:08,470 So dear, I am glad the CDC had access to private data members. 30 00:02:08,480 --> 00:02:14,590 So that's the thing, and I am glad they cannot get private members of class, which just being in ED. 31 00:02:14,620 --> 00:02:19,210 So it is like bosses having some private members there and not going anywhere. 32 00:02:19,240 --> 00:02:25,780 David Stained-glass excel because they mean we had events, but a private members staff are completely 33 00:02:25,780 --> 00:02:28,600 non accessible because we already started right. 34 00:02:28,870 --> 00:02:34,180 Private members cannot be accessed from anyone except private functions and from glasses. 35 00:02:34,180 --> 00:02:41,770 So even Biden had against private members that not accessible so that private members are not accessible. 36 00:02:41,800 --> 00:02:44,280 That's something we need to take in order. 37 00:02:44,470 --> 00:02:47,050 So, yeah, we have enough explanation here. 38 00:02:47,080 --> 00:02:49,060 I popping 13 is what will happen. 39 00:02:49,090 --> 00:02:53,680 So base closings public, then we are going with public inheritance. 40 00:02:53,680 --> 00:02:56,790 Public numbers will go to public side up that second glass. 41 00:02:56,800 --> 00:03:02,620 If it is like protected inheritance, public members go to that protected site and if it is their private 42 00:03:02,620 --> 00:03:06,400 inheritance, public will go to that private off that derived class. 43 00:03:06,410 --> 00:03:08,800 Similarly protected protected. 44 00:03:08,800 --> 00:03:11,440 If it isn't public inheritance, it will go to protect it. 45 00:03:11,440 --> 00:03:15,820 Protected if it is in case of protected inheritance, it will go to the protected one. 46 00:03:15,830 --> 00:03:21,510 But if it isn't private inheritance, then that protected members will go to that private section. 47 00:03:21,520 --> 00:03:27,730 And if you are doing private, like if you have the private members of the class in three of the inheritance 48 00:03:27,730 --> 00:03:29,500 medals, they are not accessible. 49 00:03:29,560 --> 00:03:31,630 They will not be going to anywhere. 50 00:03:31,660 --> 00:03:36,700 If it isn't based class, they're in private law, it will stay in the base class in that private mode. 51 00:03:36,700 --> 00:03:38,490 It will not be accessible to that date. 52 00:03:38,500 --> 00:03:39,220 IRA Glass. 53 00:03:39,280 --> 00:03:44,590 So now let's move them off the section to understand this concept a little bit more. 54 00:03:44,680 --> 00:03:53,100 So as usual, let's go to our Visual Studio code, and here you have this program created for inheritance. 55 00:03:53,110 --> 00:03:55,660 Yet it will be able to see let me open the dominant. 56 00:03:55,780 --> 00:04:01,140 Let me see if this is the back cover because it's showing some sort of arrows out here. 57 00:04:01,150 --> 00:04:08,320 So let me switch to this first, then try to compile this fire. 58 00:04:08,380 --> 00:04:09,940 C++ in. 59 00:04:09,940 --> 00:04:15,190 I used to have the 10 star KB. 60 00:04:15,250 --> 00:04:23,290 OK, so beginning who instead of including this one, including your stream right now, that is gone 61 00:04:23,290 --> 00:04:24,580 now this is no. 62 00:04:24,610 --> 00:04:25,190 OK, good. 63 00:04:25,210 --> 00:04:26,950 So let me explain this program. 64 00:04:26,950 --> 00:04:33,980 See, you have base class glass bat and a subclass class chain I just inherited in public me. 65 00:04:34,030 --> 00:04:34,430 OK? 66 00:04:34,450 --> 00:04:40,900 And if you see base classes having one public variable, it just entirely underscore B. 67 00:04:40,930 --> 00:04:45,550 That is our native and our classes are also having a public variable. 68 00:04:45,550 --> 00:04:46,530 It discard idea. 69 00:04:46,550 --> 00:04:47,470 Let's go see. 70 00:04:47,500 --> 00:04:54,880 So here you can see child glass is inheriting public plus Fadden right in the public eye glasses inheriting 71 00:04:54,880 --> 00:04:58,970 bad and glass in public, more so as it is public more. 72 00:04:58,990 --> 00:05:02,560 Why do we have started right now, the public member of Class Batten? 73 00:05:02,630 --> 00:05:08,410 Will be going to that Bob Blake section of the last James Whitey and underscore B will be coming out 74 00:05:08,420 --> 00:05:12,920 here along with the and associates in DA, and it will be like this. 75 00:05:13,190 --> 00:05:17,450 You are not writing this car back when you execute the program as this. 76 00:05:17,450 --> 00:05:19,460 This style is inheriting Black Baton. 77 00:05:19,640 --> 00:05:20,840 It will be like this. 78 00:05:21,250 --> 00:05:23,670 B will be also coming up on here. 79 00:05:23,690 --> 00:05:24,590 I'm commending this. 80 00:05:24,590 --> 00:05:30,770 It's not required to add it yet because that asset is inheriting all the public members and here will 81 00:05:30,770 --> 00:05:32,030 be coming our talk here. 82 00:05:32,090 --> 00:05:39,590 Then we are creating our object off that glass and trying to access both valued object 1.80 idea. 83 00:05:39,600 --> 00:05:40,280 And let's go see. 84 00:05:40,280 --> 00:05:45,800 So I am able to access the entire show value that this will show up by watching gaze of the bat and 85 00:05:45,800 --> 00:05:49,490 value items for free from the object off chain. 86 00:05:49,520 --> 00:05:50,300 Is it possible? 87 00:05:50,330 --> 00:05:54,830 Yes, it is possible because because it's inheriting this value. 88 00:05:54,830 --> 00:06:02,060 So even if this card was not there, this in IDB is being coming out here. 89 00:06:02,090 --> 00:06:06,310 So no object of child can access that value and give it value to that. 90 00:06:06,320 --> 00:06:08,360 No, I'm going to find this program. 91 00:06:08,400 --> 00:06:10,390 Hope you have bought that explanation. 92 00:06:10,400 --> 00:06:13,970 See the I to you seven and bad indictees 91. 93 00:06:13,970 --> 00:06:18,980 And how did we access the bad and dirty by using the object of that giant glass? 94 00:06:18,980 --> 00:06:25,280 Because tile classes already already inheriting the Biden bus behind this program?