1 00:00:00,060 --> 00:00:02,430 So let's start with the next section. 2 00:00:02,560 --> 00:00:10,680 We are going to talk about classes in C++, so it is the most important feature, which C++ provides 3 00:00:10,860 --> 00:00:11,790 all classes. 4 00:00:11,800 --> 00:00:19,350 So let's see what is actually a class and what is kind of Real-World exam where we can take to understand 5 00:00:19,470 --> 00:00:23,070 the concept of classes and objects in C++? 6 00:00:23,310 --> 00:00:32,580 So everything in C++, every module we create, every function we create in C++ programming language 7 00:00:32,580 --> 00:00:37,120 can be associated with the class or kind of create objects. 8 00:00:37,170 --> 00:00:45,390 So it have a lot of attributes and methods and example like this is a small example I am specifying 9 00:00:45,390 --> 00:00:46,150 in the slide. 10 00:00:46,170 --> 00:00:51,260 Like, we have a car that is an object and the car has different characteristics, right? 11 00:00:51,390 --> 00:00:58,730 So those characteristics are all attributes and it can be made color and Italian methods. 12 00:00:58,740 --> 00:01:05,430 Methods means the functions which the car can perform, such as drive and break, the function to which 13 00:01:05,430 --> 00:01:06,600 the car can perform. 14 00:01:06,600 --> 00:01:09,720 All the modules inside the car can perform in both scenarios. 15 00:01:10,080 --> 00:01:12,200 They are called methods or functions. 16 00:01:12,210 --> 00:01:17,250 So C++ class also have an entity like it's an entity. 17 00:01:17,250 --> 00:01:23,130 It have its own attributes, attributes, main characteristics and also methods. 18 00:01:23,160 --> 00:01:28,620 And class is a user defined data type, so this example seems to be way. 19 00:01:28,650 --> 00:01:34,470 So I wanted to include one more slide into this, and I want to show you that, which is a kind of a 20 00:01:34,480 --> 00:01:38,430 real world example how you can relate glass and objects. 21 00:01:38,430 --> 00:01:39,780 So let's go to the next slide. 22 00:01:39,810 --> 00:01:41,450 So if you see dog. 23 00:01:41,640 --> 00:01:44,010 Dog, is it class of animals, right? 24 00:01:44,040 --> 00:01:51,990 There are different types of dog, so we cannot see like dog as they object because dog is like not 25 00:01:51,990 --> 00:01:55,410 a genetic thing in case of object objects are not genetic. 26 00:01:55,800 --> 00:01:58,170 Objects are instances of plus. 27 00:01:58,290 --> 00:01:58,650 OK. 28 00:01:58,800 --> 00:02:06,900 So in case of a class dog is a specific class of animals and dog, that class of animals have different 29 00:02:06,900 --> 00:02:07,920 characteristics. 30 00:02:08,100 --> 00:02:13,740 So each dog have different breed, different color, different age, gender and honor. 31 00:02:13,830 --> 00:02:17,370 So these are the attributes or characteristics of the class. 32 00:02:17,370 --> 00:02:20,730 Dog and each dog have different functions. 33 00:02:20,740 --> 00:02:22,140 They can do these things right. 34 00:02:22,170 --> 00:02:23,100 They can eat. 35 00:02:23,100 --> 00:02:28,950 They can sleep, they can run, they can sit, and they can talk to these other functions they can perform. 36 00:02:29,070 --> 00:02:31,380 So dog is a genuine class. 37 00:02:31,500 --> 00:02:34,200 So how can we create objects of dog? 38 00:02:34,230 --> 00:02:40,510 So each objects up dog will be different dogs and they have different characteristics. 39 00:02:40,530 --> 00:02:42,810 So this is an object of dog. 40 00:02:42,990 --> 00:02:48,330 This is these all three are dogs, but this is a specific object of their dog. 41 00:02:48,360 --> 00:02:55,800 OK, so this is having a breed of American Eskimo that is this breed and its color is why it is aged 42 00:02:55,810 --> 00:02:56,580 six years. 43 00:02:56,790 --> 00:02:58,140 It then that is being made. 44 00:02:58,140 --> 00:02:59,400 Its owner is Jewish. 45 00:02:59,700 --> 00:03:04,020 So these are some examples of like white objects. 46 00:03:04,170 --> 00:03:12,780 So what we have as a genetic thing that will be a class, and if we create a more specific object or 47 00:03:12,780 --> 00:03:17,950 more specific instance of that particular class, then it is called an object. 48 00:03:18,030 --> 00:03:26,430 So if you can share a dog, I say class, these three dogs are objects of this class dog, OK? 49 00:03:26,610 --> 00:03:34,320 So these three dogs, mainly American Eskimo, French Bulldog and model are examples of the objects 50 00:03:34,320 --> 00:03:35,110 of this class. 51 00:03:35,130 --> 00:03:36,660 Know what we have understood. 52 00:03:36,870 --> 00:03:44,580 So if we want to create something in general, we create a class and we respect all the associated variables. 53 00:03:44,640 --> 00:03:45,060 OK? 54 00:03:45,240 --> 00:03:50,940 All the associated members of the class and all associated functions of the class in that particular 55 00:03:50,940 --> 00:03:51,430 class. 56 00:03:51,450 --> 00:03:53,250 That's how we create class. 57 00:03:53,280 --> 00:03:56,730 Now let's see how we create a class in C++. 58 00:03:56,760 --> 00:03:58,980 So this is the syntax explanation. 59 00:03:59,040 --> 00:04:06,560 So if we want to create a class named great class in C++, you just need to create your secured card 60 00:04:06,570 --> 00:04:09,000 class, followed by your last name. 61 00:04:09,030 --> 00:04:11,070 Then you have to open the curly braces. 62 00:04:11,080 --> 00:04:13,630 You have to list out back to specify. 63 00:04:13,680 --> 00:04:14,410 So you have it. 64 00:04:14,650 --> 00:04:15,870 What is access press event? 65 00:04:16,050 --> 00:04:21,960 We will move into that school and you will list out all the functions and variables associated with 66 00:04:21,960 --> 00:04:23,310 that particular class. 67 00:04:23,580 --> 00:04:27,270 Then you close the curly braces and semicolon. 68 00:04:27,300 --> 00:04:30,220 That's how you create a class in C++. 69 00:04:30,270 --> 00:04:34,410 Now we can create an object of the class like I have X. 70 00:04:34,950 --> 00:04:42,280 I have shown at the dog is a class and American Eskimo is an object of that particular class. 71 00:04:42,300 --> 00:04:46,290 It's also a dog, but it's more specific, right? 72 00:04:46,380 --> 00:04:51,470 So an object is a specific instance of a class and how you can create an object. 73 00:04:51,480 --> 00:04:56,140 After you create that class, you will put the class namespace object. 74 00:04:56,550 --> 00:04:59,520 That's how you create that object in C++. 75 00:04:59,740 --> 00:05:05,140 Now, let's move to a quick demo on this section so that you will get more understanding on this. 76 00:05:05,440 --> 00:05:07,450 So let me go to Visual Studio Code. 77 00:05:07,480 --> 00:05:08,860 We are missing our terminal. 78 00:05:08,860 --> 00:05:11,830 Let me open the terminal for you so you can see here. 79 00:05:12,130 --> 00:05:16,000 This is an example of this class in C++. 80 00:05:16,120 --> 00:05:19,060 Here I have created a class named Goch.