1 00:00:01,070 --> 00:00:07,640 The class keyboard so you can replace destruct keyboard within the class keyboard. 2 00:00:07,670 --> 00:00:11,320 So which the class members private by default. 3 00:00:11,330 --> 00:00:18,560 So aside from default access controls classes declared with this struct and class, keywords are the 4 00:00:18,560 --> 00:00:19,030 same. 5 00:00:19,040 --> 00:00:24,390 So for example, you could declare my date and time just a class here. 6 00:00:24,410 --> 00:00:25,640 As you can see here. 7 00:00:26,510 --> 00:00:29,390 We just need to arrange these methods here. 8 00:00:30,530 --> 00:00:37,660 So then here, as you can see here, let's make this like that. 9 00:00:37,670 --> 00:00:42,470 And here we will make this functions public. 10 00:00:43,160 --> 00:00:47,840 And as you can see here, we can run our code without any problem here. 11 00:00:47,990 --> 00:00:52,550 So which way you declare class is a matter of style. 12 00:00:52,550 --> 00:00:57,530 So there's absolutely no difference between between struct and class. 13 00:00:57,560 --> 00:01:00,050 Aside from the access controls. 14 00:01:00,050 --> 00:01:01,010 So there are. 15 00:01:01,040 --> 00:01:02,570 They are almost same. 16 00:01:03,020 --> 00:01:04,400 And they are. 17 00:01:06,050 --> 00:01:12,500 They're like absolutely the same, but they have like different there are different things differentiating 18 00:01:13,070 --> 00:01:14,750 on access controls. 19 00:01:14,750 --> 00:01:18,810 So I prefer using struct sometimes, sometimes class. 20 00:01:18,810 --> 00:01:26,300 So and you may like use struct because having the public members list at first. 21 00:01:26,300 --> 00:01:32,390 So but you will see all kinds of conversions out in the programming life. 22 00:01:32,660 --> 00:01:36,110 So cultivate style and stick to it. 23 00:01:36,680 --> 00:01:38,300 So now I want to. 24 00:01:39,570 --> 00:01:47,010 Having encapsulated we have encapsulated the year, as you can see here, we have get here and adhere. 25 00:01:47,130 --> 00:01:51,270 So you must now use methods to interact with this. 26 00:01:52,130 --> 00:01:53,540 The my date and time. 27 00:01:53,540 --> 00:01:56,210 So here I want to. 28 00:01:57,460 --> 00:01:59,740 Set for something here. 29 00:01:59,830 --> 00:02:00,700 So. 30 00:02:01,910 --> 00:02:06,930 Let's delete this code and create New Year. 31 00:02:06,980 --> 00:02:12,290 My date and time and clock. 32 00:02:13,900 --> 00:02:17,050 Here if here is not. 33 00:02:17,050 --> 00:02:18,130 Operator Ternary. 34 00:02:18,130 --> 00:02:21,460 Operator clock that set year. 35 00:02:22,320 --> 00:02:23,730 2018. 36 00:02:25,480 --> 00:02:26,040 Here. 37 00:02:26,710 --> 00:02:30,430 And clock that set here doesn't 19. 38 00:02:31,750 --> 00:02:42,040 And then I will explain all of these codes here that appear here and print this year. 39 00:02:42,580 --> 00:02:45,670 Here is the. 40 00:02:47,260 --> 00:02:50,290 And clock that get here. 41 00:02:52,190 --> 00:02:53,970 That's not in our code. 42 00:02:53,990 --> 00:02:59,210 As you can see, we got the output of two 2020 here. 43 00:02:59,210 --> 00:03:07,190 So firstly, we declare the clock here and attempt to set its year to 2018. 44 00:03:07,490 --> 00:03:08,510 So. 45 00:03:09,480 --> 00:03:15,180 This file fails because 2018 is less than 2019, as you can see here. 46 00:03:15,900 --> 00:03:16,830 We will. 47 00:03:16,830 --> 00:03:17,520 We will. 48 00:03:17,610 --> 00:03:26,370 As you remember in previous lectures, we will return false from if our set year value parameter had 49 00:03:27,120 --> 00:03:28,910 less than 2019. 50 00:03:28,920 --> 00:03:37,490 So in this case, this statement the here returned true because we have the ternary operator here. 51 00:03:37,500 --> 00:03:42,630 So if you have this operator, we just change true to false. 52 00:03:42,660 --> 00:03:52,950 If it's false to true, so and then you increment here, as you can see here, you increment clock to 53 00:03:53,190 --> 00:03:58,050 add ever by one with this function and. 54 00:03:59,380 --> 00:04:04,870 You increment once and you get the gate here and here. 55 00:04:05,350 --> 00:04:07,600 This the output of it here.