1 00:00:13,860 --> 00:00:20,280 Hello and welcome to the goal and programming language course in the conversation we talked about Method 2 00:00:20,280 --> 00:00:23,850 can accept both points from value in decision. 3 00:00:24,060 --> 00:00:26,910 We want to talk about the other this concept. 4 00:00:29,930 --> 00:00:32,810 Assign different value for a struct field. 5 00:00:34,360 --> 00:00:42,430 Method of assigning to custom default value can be achieved by using constructor function instead of 6 00:00:42,430 --> 00:00:44,500 creating a strong directory. 7 00:00:44,740 --> 00:00:51,520 We create a function can be used to create an struggled with the cost and default value for this distronic 8 00:00:51,700 --> 00:00:52,270 feats. 9 00:00:54,730 --> 00:01:00,760 Let's go to this good program to illustrate how to assign defined value for restaurant field. 10 00:01:04,020 --> 00:01:17,430 First, create a strike named A-student, tie this to the restaurant called Graisses and define fields 11 00:01:17,430 --> 00:01:18,480 for this strike. 12 00:01:18,880 --> 00:01:23,970 Name is string and age. 13 00:01:24,660 --> 00:01:30,870 It set the common above the established name for exporting, this student stressed. 14 00:01:33,260 --> 00:01:37,520 Still, there are strict. 15 00:01:40,180 --> 00:01:47,710 Now, create a metal for a student assignment name instance to set default value for a student feels 16 00:01:51,970 --> 00:01:52,560 fine. 17 00:01:54,100 --> 00:01:59,380 Set a receipt for a student as strong as S s as trees. 18 00:01:59,980 --> 00:02:06,190 The student named for this metal, for example. 19 00:02:06,280 --> 00:02:11,050 Instant, curly brackets. 20 00:02:12,940 --> 00:02:17,920 In this case, set the default value for two fields, name and age. 21 00:02:18,370 --> 00:02:25,210 If that name equals equals, no 22 00:02:27,970 --> 00:02:38,050 less name equals rather than if it's the age. 23 00:02:39,660 --> 00:02:46,800 Equals equals zero is that h equals twenty five. 24 00:02:49,030 --> 00:02:56,050 The compiler checks if the field values are and so assigns, the value defined in this method as defined 25 00:02:56,050 --> 00:03:05,770 values, voting set a comment for this method as export in turn 26 00:03:08,530 --> 00:03:11,550 metals reform as they call, then save that provision. 27 00:03:12,040 --> 00:03:18,220 Now, go to main function and create instances of student astrong and initialize value. 28 00:03:21,490 --> 00:03:28,600 First, declare an instance and mete out assigned value is to that point where calling equals. 29 00:03:31,090 --> 00:03:38,530 A student now invokes the instant method for initializing default values. 30 00:03:39,240 --> 00:03:49,000 This student won't even stand up and display these students, right? 31 00:03:49,600 --> 00:03:49,990 If 32 00:03:52,970 --> 00:03:54,520 the student one 33 00:03:57,790 --> 00:04:05,620 second declare another student instance and just initialize name value for it and don't assign any value 34 00:04:05,620 --> 00:04:11,560 for each bit, go to the next line is to do that. 35 00:04:12,400 --> 00:04:19,420 Two column equals the student and set name. 36 00:04:22,150 --> 00:04:22,630 Julia? 37 00:04:26,440 --> 00:04:40,840 Student to go out and stand and display this, a student in the strike as the student to and to declare 38 00:04:40,840 --> 00:04:47,620 another student in the stands and just initialize a value for it and don't assign venue for name field, 39 00:04:48,640 --> 00:04:50,080 go to the next line. 40 00:04:51,160 --> 00:04:52,600 Define the variable light. 41 00:04:52,750 --> 00:05:07,390 Student three column equals the student and said just age by the age, for example 30 and involve the 42 00:05:07,390 --> 00:05:09,790 instant method student. 43 00:05:10,360 --> 00:05:12,790 Treat these Typekit. 44 00:05:13,870 --> 00:05:17,370 Go to the next line and display this a student. 45 00:05:17,380 --> 00:05:26,470 If the student three reformat the code, save the project and execute the program. 46 00:05:28,130 --> 00:05:32,010 Now we can see the output for students want. 47 00:05:32,030 --> 00:05:34,130 We don't have initialize a student. 48 00:05:34,970 --> 00:05:41,210 So after invoking Mr. Smith to the name and age fields value set to define value. 49 00:05:42,450 --> 00:05:47,130 Means Robert and Tony fine for student two. 50 00:05:47,250 --> 00:05:54,750 We don't have initialise age field, so after we walk ins transmittal the age feed value set different 51 00:05:54,750 --> 00:06:00,060 value means Julia and twenty five and four student three. 52 00:06:00,210 --> 00:06:06,270 We don't have initialise name field, so Anthony won't Mr. Smith, with the name field value set to 53 00:06:06,270 --> 00:06:14,100 default value means Robert and Turkey, so he could assign default value for this tournament via a method. 54 00:06:14,240 --> 00:06:14,560 OK. 55 00:06:14,670 --> 00:06:20,010 In order not to prolong the time of decision, we will finish it and we will continue the content in 56 00:06:20,010 --> 00:06:21,000 the next session. 57 00:06:21,270 --> 00:06:21,810 Goodbye.