1 00:00:00,880 --> 00:00:07,550 The class keyword so you can replace the struct keyword within the class keyword. 2 00:00:07,570 --> 00:00:11,220 So which declares members private by default. 3 00:00:11,230 --> 00:00:13,700 So aside from default access controls. 4 00:00:13,720 --> 00:00:18,970 Classes declared with the struct and class keywords are the same. 5 00:00:18,970 --> 00:00:24,340 So for example, you could declare my date and time just the class here. 6 00:00:24,340 --> 00:00:29,290 As you can see here, we just need to arrange these methods here. 7 00:00:30,340 --> 00:00:41,500 So then here, as you can see here, let's make this like that and here and we will make this functions 8 00:00:41,500 --> 00:00:42,490 public. 9 00:00:42,880 --> 00:00:47,830 And as you can see here, we can run our code without any problem here. 10 00:00:47,830 --> 00:00:52,480 So which way you declare class is a matter of style. 11 00:00:52,480 --> 00:00:59,980 So there's absolutely no difference between between struct and class aside from the access controls. 12 00:00:59,980 --> 00:01:04,300 So there are they are almost same and they are. 13 00:01:05,940 --> 00:01:07,390 They are like, absolutely insane. 14 00:01:07,390 --> 00:01:14,650 But they have like different they are different thing differentiating on access controls. 15 00:01:14,650 --> 00:01:18,730 So I prefer using struct sometimes, sometimes class. 16 00:01:18,730 --> 00:01:26,200 So and you may like use struct because having the public members listed first. 17 00:01:26,200 --> 00:01:32,350 So but you will see all kinds of conventions out in the programming life. 18 00:01:32,470 --> 00:01:36,190 So cultivate a style and stick to it. 19 00:01:36,490 --> 00:01:38,260 So now I want to. 20 00:01:39,470 --> 00:01:43,040 Having encapsulated the we have encapsulated here. 21 00:01:43,040 --> 00:01:45,650 As you can see here, we have get. 22 00:01:45,680 --> 00:01:46,970 Here and add here. 23 00:01:46,970 --> 00:01:51,200 So you must now use methods to interact with this. 24 00:01:52,000 --> 00:01:53,470 The my date and time. 25 00:01:53,470 --> 00:01:56,110 So here I want to. 26 00:01:57,420 --> 00:02:00,660 Seth for something here, so. 27 00:02:01,750 --> 00:02:05,980 Let's delete this code and create new. 28 00:02:06,230 --> 00:02:12,250 Here my date and time and clock. 29 00:02:13,650 --> 00:02:14,220 Here. 30 00:02:14,220 --> 00:02:16,980 If here not. 31 00:02:16,980 --> 00:02:17,610 Operator. 32 00:02:17,610 --> 00:02:18,820 Ternary operator. 33 00:02:18,840 --> 00:02:21,420 Clock dot set here. 34 00:02:22,190 --> 00:02:23,690 2018. 35 00:02:25,380 --> 00:02:29,060 Here and clock that set here. 36 00:02:29,110 --> 00:02:30,330 Dozen 19. 37 00:02:31,560 --> 00:02:41,940 And then I will explain all of these codes here, clock that are here, here, and print f here. 38 00:02:42,450 --> 00:02:45,630 Here is the. 39 00:02:47,220 --> 00:02:50,220 And clock that get here. 40 00:02:52,000 --> 00:02:52,600 Let's run. 41 00:02:53,050 --> 00:02:53,890 Let's run our code. 42 00:02:53,890 --> 00:02:59,170 As you can see, we got the output of to 2020 here. 43 00:02:59,170 --> 00:03:07,150 So firstly, we declare the clock here and attempt to set its year to 2018. 44 00:03:07,270 --> 00:03:08,320 So. 45 00:03:09,320 --> 00:03:13,950 This file fails because 2018 is less than 2019. 46 00:03:13,970 --> 00:03:17,440 As you can see here, we will we will. 47 00:03:17,450 --> 00:03:26,480 As you remember in previous lectures, we will return false from if our set year value parameter had 48 00:03:26,990 --> 00:03:28,840 less than 2019. 49 00:03:28,850 --> 00:03:37,400 So in this case this statement the here returned true because we have the ternary operator here. 50 00:03:37,400 --> 00:03:42,530 So if you have this operator, we just change true to false. 51 00:03:42,560 --> 00:03:44,480 If it's false to true. 52 00:03:44,480 --> 00:03:55,220 So and then you increment here, as you can see here, you increment a clock that add a year by one 53 00:03:55,520 --> 00:03:57,980 with this function and. 54 00:03:59,100 --> 00:04:04,830 Now you increment it once and you get the get here and here. 55 00:04:05,250 --> 00:04:07,590 This output of it here.