1
00:00:00,540 --> 00:00:05,080
Devey you initialize an object from a class has a lot of implications.

2
00:00:05,100 --> 00:00:12,000
That is how you do it what kind of promises you have to enter in your initialising good as well as you

3
00:00:12,000 --> 00:00:15,960
know the impact it has on the life cycle of an object.

4
00:00:15,960 --> 00:00:21,490
So this is an under the creeky talked about the initialization methods and why you have to use them

5
00:00:21,490 --> 00:00:23,310
and how you have to use them.

6
00:00:23,310 --> 00:00:25,450
Let's go to ex-cult and the next score.

7
00:00:25,470 --> 00:00:28,750
I'm going to go ahead and start a new command line tool.

8
00:00:28,770 --> 00:00:31,920
I'm going to call it initialize.

9
00:00:31,990 --> 00:00:34,840
I didn't initialize.

10
00:00:35,100 --> 00:00:38,820
I'm going to go ahead and start a new class.

11
00:00:38,970 --> 00:00:41,210
So let's call this one again.

12
00:00:41,250 --> 00:00:43,920
A User class.

13
00:00:43,930 --> 00:00:46,430
And let's see what we have for it in here.

14
00:00:46,440 --> 00:00:51,000
I'm actually going to go and add five different attributes to my class.

15
00:00:51,000 --> 00:01:01,970
So the substitutes are going to be great name you Id not like that you like the photo and email and

16
00:01:02,180 --> 00:01:08,010
to declare all of them I'm going to use de-friended ways of doing them because each of them has to be

17
00:01:08,010 --> 00:01:10,260
initialized in a different way.

18
00:01:10,530 --> 00:01:16,710
So this isn't exactly a scientific way of doing some of these might be said in different ways.

19
00:01:16,830 --> 00:01:20,670
But for now I think the way you're going to do with this kind of making sense.

20
00:01:20,820 --> 00:01:24,550
So for rape I'm going to say it's a variable is mutable.

21
00:01:24,720 --> 00:01:27,170
It is of the type float.

22
00:01:27,180 --> 00:01:29,900
I'm going to say it has to be 0 at the beginning.

23
00:01:29,900 --> 00:01:35,000
So when you are initializing a user it's current rate should be zero.

24
00:01:35,250 --> 00:01:39,380
Then I'm going to go ahead and say there is a name and the name is a string.

25
00:01:39,450 --> 00:01:40,820
And that's about that.

26
00:01:40,920 --> 00:01:42,380
It is not optional.

27
00:01:42,420 --> 00:01:45,500
It has to be initialized at some point.

28
00:01:45,510 --> 00:01:50,430
Then I'm going to go ahead and say that is a viable ID which is a string.

29
00:01:50,580 --> 00:01:56,110
It is an optional but an option that I know really soon it is going to be set.

30
00:01:56,160 --> 00:02:01,650
So we have to really set it really really almost immediately after the initialization.

31
00:02:01,650 --> 00:02:07,820
Then I have another one called variable for thought which is a name of a string and that is optional.

32
00:02:07,860 --> 00:02:11,310
I don't know if my user has a photo or not.

33
00:02:11,310 --> 00:02:13,880
And then finally I have something that is a list.

34
00:02:13,890 --> 00:02:15,470
It is a static value.

35
00:02:15,600 --> 00:02:16,710
It's a constant.

36
00:02:16,710 --> 00:02:22,530
Is not going to change what we have to set it at initialization.

37
00:02:22,530 --> 00:02:25,050
So then the right is really quickly.

38
00:02:25,050 --> 00:02:35,010
So rate is set at default and then name is not optional.

39
00:02:35,340 --> 00:02:44,070
And then I have the new ID which will be set real soon almost immediately photo which is completely

40
00:02:44,070 --> 00:02:51,960
optional and I have an email which is Konstanz what can be set up in it.

41
00:02:52,350 --> 00:02:53,580
So what does it mean.

42
00:02:53,580 --> 00:02:56,450
It means that we have these five attributes.

43
00:02:56,710 --> 00:03:02,190
And let me see how many of them are name which is not an option.

44
00:03:02,640 --> 00:03:07,740
And email which is not an option I should have mentioned that not optional.

45
00:03:08,040 --> 00:03:09,820
These two have to set.

46
00:03:09,840 --> 00:03:12,150
No matter what the others.

47
00:03:12,150 --> 00:03:15,630
We can just leave them for now and then decide about them later.

48
00:03:15,660 --> 00:03:21,090
Now excuses is giving me an error or saying that your class has no initializers So let's go ahead then

49
00:03:21,210 --> 00:03:22,580
add an NGO.

50
00:03:22,940 --> 00:03:28,410
I'm going to say in it and in the unit I know two things that they must be there.

51
00:03:28,410 --> 00:03:36,370
So one of them is this that Mary you know or there are things so kind of makes more sense like that.

52
00:03:36,480 --> 00:03:45,210
So you might I say input's name which is going to be a string an input e-mail which is again going to

53
00:03:45,210 --> 00:03:54,890
be a string and whatever that it does I'm going to say self that e-mail is input E-Man and self-caused

54
00:03:54,900 --> 00:03:58,330
name is going to be input name.

55
00:03:58,350 --> 00:04:04,740
So now I have one in it that initializes the tool guys that are not optional.

56
00:04:04,890 --> 00:04:08,010
Everybody else you know we could deal with them later on.

57
00:04:08,010 --> 00:04:15,870
Now if I go ahead and say that my user is going to be user is going to say well we do like to initialize

58
00:04:15,870 --> 00:04:16,970
it be dismantled.

59
00:04:17,130 --> 00:04:24,290
And this is now the only method that we can use to initialize our users simply because they have overridden

60
00:04:24,290 --> 00:04:27,000
that any it we can't use this anymore.

61
00:04:27,450 --> 00:04:33,390
Now sometimes not just sometimes a lot of times you have situations that you have more than one kind

62
00:04:33,390 --> 00:04:34,270
of in it.

63
00:04:34,290 --> 00:04:39,040
Imagine this my array is N.S. are a dot in it.

64
00:04:39,210 --> 00:04:45,450
And then in the net as you can see we have multiple different types of in it's in it's with an array

65
00:04:45,890 --> 00:04:50,370
in it with an industry in it for the Khoder object things that you know some of them we know what they

66
00:04:50,370 --> 00:04:51,980
are some of them we don't know what we are.

67
00:04:52,140 --> 00:04:58,300
So we have to actually choose which one of these you know anything you want to use and what I want it

68
00:04:58,300 --> 00:05:04,470
to have that for my user stuff going here and say well there is another in it.

69
00:05:04,720 --> 00:05:08,840
And in the other end it the two things that there must be there they are there.

70
00:05:09,130 --> 00:05:11,180
Nobody is going to have a question about them.

71
00:05:11,320 --> 00:05:16,890
But I also haven't put forth all which this time it is there.

72
00:05:17,020 --> 00:05:19,830
And these two things happen as they should.

73
00:05:20,110 --> 00:05:24,770
And then self-taught photo gets to be input for as.

74
00:05:24,940 --> 00:05:34,960
So now if I try to make a user if I go in here and say like my user is going to be user then I have

75
00:05:34,970 --> 00:05:41,940
to what we call flavors of dysfunction two different ways of triggering in it.

76
00:05:41,980 --> 00:05:44,560
One of them would need to like humans.

77
00:05:44,560 --> 00:05:46,640
One of them would need three arguments.

78
00:05:46,800 --> 00:05:52,190
Let's choose this one input name an input email or both are empty.

79
00:05:52,540 --> 00:05:54,060
And that's pretty much about it.

80
00:05:54,070 --> 00:06:00,870
So we have two or three or 10 or hundreds of different types of minutes and then we have attributes

81
00:06:00,880 --> 00:06:03,680
we have to know whether they're optional or not optional.

82
00:06:03,790 --> 00:06:09,470
If they're not optional they have to be somewhere within our in it or they have to have a default value

83
00:06:09,470 --> 00:06:10,650
such as this one.

84
00:06:10,870 --> 00:06:17,020
And then we have to write the body off or in its methods and then depending on our use we can use this

85
00:06:17,020 --> 00:06:19,250
one or the other one or any other one.

86
00:06:19,390 --> 00:06:23,800
There is one kind of initialization that's got a convenience in it.

87
00:06:23,890 --> 00:06:30,110
I should have mentioned that these guys are card designated in it's so that the designator then it also

88
00:06:30,120 --> 00:06:30,910
has this one.

89
00:06:31,120 --> 00:06:36,310
And then the next listener we're going to talk about a convenience and it and it that helps us you know

90
00:06:36,690 --> 00:06:39,090
be special cases and so on.

91
00:06:39,100 --> 00:06:40,450
So I assume that then.
