1 00:00:00,000 --> 00:00:02,700 All right. Let's create our first class object, 2 00:00:02,700 --> 00:00:05,800 and I promise you, this is going to be super, super easy. 3 00:00:05,820 --> 00:00:07,980 We're not going to do anything fancy. 4 00:00:07,990 --> 00:00:11,020 We're going to start from the very basics. 5 00:00:11,030 --> 00:00:14,950 So when we create a class, we use the keyword 'class', and 6 00:00:14,950 --> 00:00:19,600 then we give it a name such as 'MyClass', and then a ':', 7 00:00:19,620 --> 00:00:24,580 and we indent, and anything that's indented under this section 8 00:00:24,590 --> 00:00:28,300 here that has this hidden sort of space here, this invisible 9 00:00:28,300 --> 00:00:31,400 space rather, when it's indented, that means it's part of this class. 10 00:00:31,400 --> 00:00:34,400 Now, all I'm going to do is type the word 'pass', 11 00:00:34,420 --> 00:00:37,660 and I'm actually going to show you why we need to do that. 12 00:00:39,200 --> 00:00:41,000 'unexpected end of file 13 00:00:41,050 --> 00:00:44,510 while parsing'. Didn't understand that there was supposed to 14 00:00:44,520 --> 00:00:46,340 be something here, or in this case, nothing. 15 00:00:46,350 --> 00:00:49,310 So Python says, "Okay, you need to have that indenting". 16 00:00:49,310 --> 00:00:52,100 And 'pass' is a keyword that allows us to basically say, "Hey, 17 00:00:52,100 --> 00:00:53,100 there's nothing in here. 18 00:00:53,100 --> 00:00:54,500 But keep this". 19 00:00:55,200 --> 00:00:56,500 So let's go ahead and run that, 20 00:00:56,500 --> 00:00:59,300 and let's instantiate our new class. 21 00:00:59,300 --> 00:01:00,900 So let's call this 'new_class', 22 00:01:01,900 --> 00:01:06,200 and you'll notice I'm using camel casing here where every 23 00:01:06,200 --> 00:01:08,700 letter of every word starts with an uppercase and 24 00:01:08,700 --> 00:01:09,800 everything else is lowercase. 25 00:01:09,860 --> 00:01:12,440 And in a variable, I'm using what's called snake casing, 26 00:01:12,440 --> 00:01:13,800 where everything is lowercase, 27 00:01:13,800 --> 00:01:18,900 and instead of using spaces or upper case letters like we 28 00:01:18,910 --> 00:01:22,080 use here, we just use an underscore. 29 00:01:22,090 --> 00:01:26,770 So 'new_class = MyClass', and we are going to use 30 00:01:26,770 --> 00:01:28,000 parentheses around that. 31 00:01:28,060 --> 00:01:30,910 And this just tells Python to instantiate this, 32 00:01:30,920 --> 00:01:34,090 so to actually run this class for us, and that's what it's 33 00:01:34,100 --> 00:01:35,680 going to do. It's going to set it up for us. 34 00:01:36,800 --> 00:01:41,800 And then if we run, 'type(new_class)', '__main__', which we'll talk 35 00:01:41,900 --> 00:01:44,260 about down the road, '.MyClass'. 36 00:01:44,350 --> 00:01:47,260 And that's basically saying that we have a new object here. 37 00:01:47,260 --> 00:01:51,600 So if we did 'type(str)', we're going to see that's not going to work. 38 00:01:51,640 --> 00:01:54,940 ,If we did 'type("str")'. There we go, 39 00:01:54,950 --> 00:01:55,900 that's a better example. 40 00:01:55,900 --> 00:01:57,300 We can see that is a 'str'. 41 00:01:57,300 --> 00:02:03,000 And if we print it, 'print(type("str"))', we can see it's 42 00:02:03,000 --> 00:02:06,200 a 'class' called 'str'. It's a string. 43 00:02:06,800 --> 00:02:09,199 Ours is a class called 'MyClass'. 44 00:02:09,900 --> 00:02:12,100 So what I would like you to do for this video, if you're 45 00:02:12,160 --> 00:02:15,900 brand new to Object Oriented Programming, just create a very 46 00:02:16,100 --> 00:02:18,100 simple instance of an object here. 47 00:02:18,120 --> 00:02:19,830 Use 'class MyClass'. 48 00:02:19,840 --> 00:02:21,360 Don't put anything in it. 49 00:02:21,360 --> 00:02:23,400 Just put 'pass', and then instantiate it. 50 00:02:23,400 --> 00:02:26,900 That's all you need to do to get started with Object Oriented 51 00:02:26,900 --> 00:02:28,300 Programming.