1 00:00:00,960 --> 00:00:01,740 Welcome back. 2 00:00:02,040 --> 00:00:08,189 And this video, I would like to introduce you to classes and objects, and they are a very important 3 00:00:08,189 --> 00:00:10,410 aspect of object oriented programming. 4 00:00:10,740 --> 00:00:12,100 We've seen class before. 5 00:00:12,120 --> 00:00:19,680 For example, our main activity class is one of those classes, and a class is, so to say, a blueprint 6 00:00:20,100 --> 00:00:21,330 of an object. 7 00:00:22,020 --> 00:00:24,150 So let's have a look at a specific example. 8 00:00:24,450 --> 00:00:27,810 So let's say I have this very beautiful car here. 9 00:00:29,450 --> 00:00:31,400 And this car. 10 00:00:32,800 --> 00:00:36,190 There's going to be our class that I. 11 00:00:41,270 --> 00:00:43,880 And this car has certain properties. 12 00:00:45,370 --> 00:00:47,170 So props. 13 00:00:48,530 --> 00:00:52,910 And those properties would be, for example, its maximum speed. 14 00:00:55,390 --> 00:00:58,780 Then it could be the amount of tires it has. 15 00:01:00,380 --> 00:01:03,530 So, Max Speed tires. 16 00:01:05,850 --> 00:01:10,710 Then the amount of windows, maybe even or doors. 17 00:01:10,800 --> 00:01:15,660 So there are cars with two doors that are cars with three doors and so forth. 18 00:01:16,260 --> 00:01:16,710 So. 19 00:01:19,680 --> 00:01:25,740 Force would be another property, and then this car has a bunch of skills. 20 00:01:26,640 --> 00:01:31,320 For example, it can drive, so I'm just going to call this one skills. 21 00:01:32,860 --> 00:01:34,240 And there will be. 22 00:01:35,210 --> 00:01:35,930 Drive. 23 00:01:38,740 --> 00:01:41,050 Then what can the car else do? 24 00:01:41,170 --> 00:01:44,530 Well, it can break, hopefully. 25 00:01:45,580 --> 00:01:53,980 Because otherwise we might be screwed, so it drives, it breaks, it has a bunch of other skills or 26 00:01:53,980 --> 00:01:58,420 capabilities in a class, these properties could be variables. 27 00:01:59,480 --> 00:02:02,210 And those skills could be methods. 28 00:02:03,200 --> 00:02:06,110 So these are things that we have seen already. 29 00:02:06,290 --> 00:02:09,650 Now the only thing we need to do is we need to create our own class. 30 00:02:10,370 --> 00:02:12,800 So now, as I said, a class is a blueprint. 31 00:02:13,100 --> 00:02:18,140 So when I create a class, I create a blueprint for car objects. 32 00:02:18,500 --> 00:02:24,170 So now I can go ahead and create a car with a speed of, let's say, 200 miles per hour. 33 00:02:24,500 --> 00:02:29,150 I can say this car is going to have four tires and it's going to have two doors because it doesn't need 34 00:02:29,150 --> 00:02:32,360 any more, and it's going to have the skill of driving. 35 00:02:32,360 --> 00:02:38,030 And of course, it's also going to have the skill of braking, but it's going to also have a turbo boost 36 00:02:38,030 --> 00:02:38,540 mode. 37 00:02:39,050 --> 00:02:43,910 Then it's going to have the steering capability and so forth. 38 00:02:44,510 --> 00:02:44,930 All right. 39 00:02:45,230 --> 00:02:48,710 And now, of course, this will be my object here. 40 00:02:48,710 --> 00:02:54,800 So this will be another car that I just created this super fast turbo car that I've just created. 41 00:02:56,380 --> 00:03:05,230 And as I said, it just has this one big door here doesn't need more right or one door on one side and 42 00:03:05,230 --> 00:03:06,370 one door on the other side. 43 00:03:06,730 --> 00:03:10,510 Now the trick question here is what is the front of this car? 44 00:03:10,720 --> 00:03:12,760 Is it here or is it there? 45 00:03:13,700 --> 00:03:15,950 Well, it doesn't really matter, I'm just joking. 46 00:03:16,160 --> 00:03:22,220 So that's one object, but now I can go ahead and create a bunch of these objects, so now I can go 47 00:03:22,220 --> 00:03:27,770 ahead and create a bunch of cars and they all look a little different and they all have different colors. 48 00:03:27,770 --> 00:03:32,390 So another property could be the color, for example. 49 00:03:32,480 --> 00:03:33,290 That's a good one. 50 00:03:34,560 --> 00:03:40,200 Wheel size could be another one and so forth, so you can see you can have all of these different properties. 51 00:03:40,740 --> 00:03:41,640 And now this. 52 00:03:43,020 --> 00:03:46,470 Is the difference between classes and objects? 53 00:03:46,560 --> 00:03:54,750 A class is just a blueprint where we define all of these values, such as properties and skills. 54 00:03:55,350 --> 00:04:02,670 And then the objects are the individual cars that are produced, for example, and this can be used 55 00:04:02,670 --> 00:04:04,200 for pretty much anything, right? 56 00:04:04,590 --> 00:04:06,030 You could say a human. 57 00:04:06,450 --> 00:04:08,130 So what are the properties of humans? 58 00:04:08,220 --> 00:04:10,740 Well, we have a certain age that age changes. 59 00:04:11,250 --> 00:04:12,900 Then we have a name. 60 00:04:13,620 --> 00:04:17,160 We have eye colors, hair colors and so forth. 61 00:04:17,490 --> 00:04:20,310 So all of these things would be our properties. 62 00:04:20,430 --> 00:04:25,380 And then we have skills such as breathe or sleep or walk jump. 63 00:04:25,740 --> 00:04:30,450 All of these things would be our skills, and those skills would be our methods that we would create. 64 00:04:31,350 --> 00:04:31,770 All right. 65 00:04:32,010 --> 00:04:37,650 So this is just a quick introduction to classes, and we're going to see how we can use classes, how 66 00:04:37,650 --> 00:04:44,280 we can build our own classes, give them those properties and those skills or methods and how we can 67 00:04:44,430 --> 00:04:45,630 create objects of those. 68 00:04:46,200 --> 00:04:46,650 All right. 69 00:04:46,980 --> 00:04:50,790 So I'd say, let's dive right into it because it's a lot more fun in practice. 70 00:04:51,090 --> 00:04:51,840 So see you there.