1 00:00:01,610 --> 00:00:07,310 And now are forward here let us remove all discord and let us explore more. 2 00:00:07,760 --> 00:00:13,880 Now suppose you want to print your legacy name so here I will simply define that space. 3 00:00:13,910 --> 00:00:15,430 Name equal to. 4 00:00:15,560 --> 00:00:16,730 Let's see Steve. 5 00:00:16,760 --> 00:00:18,690 Now let us try something different. 6 00:00:18,770 --> 00:00:20,370 Let's see that space. 7 00:00:20,370 --> 00:00:22,930 Name on all of their dipole string. 8 00:00:23,110 --> 00:00:24,010 And later on. 9 00:00:24,170 --> 00:00:27,190 Use name equal to Steve. 10 00:00:27,260 --> 00:00:33,440 And here it is in the name and now it is called. 11 00:00:33,460 --> 00:00:36,370 So in the output we get Steve right. 12 00:00:36,520 --> 00:00:42,100 Now suppose I want to print this name with the help of some With the help of some function defined inside 13 00:00:42,140 --> 00:00:44,320 though my first files are guilty. 14 00:00:44,320 --> 00:00:49,280 So here on the side I will simply create one would function by using the keyword of. 15 00:00:49,300 --> 00:00:56,260 If you end legacy display use the Blackard open and close and defined the method Barbie. 16 00:00:56,320 --> 00:00:58,680 Now inside this does use brain. 17 00:00:58,870 --> 00:01:00,980 And here there is aspirin Steve. 18 00:01:01,060 --> 00:01:05,170 Now my object is that I want to pass this value here. 19 00:01:05,230 --> 00:01:10,990 Inside their display method so far that what they really do I would simply define a variable like say 20 00:01:10,990 --> 00:01:15,190 name colon then string. 21 00:01:15,190 --> 00:01:20,850 Now in Cartland in order to define any variable along with their data type the syntax is this. 22 00:01:20,860 --> 00:01:26,560 First you need to define the variable name followed by a colon and then you find a date or type. 23 00:01:26,560 --> 00:01:31,800 So here instead of printing this Steve directly they can simply print out name. 24 00:01:32,020 --> 00:01:32,860 And now here. 25 00:01:32,950 --> 00:01:38,530 Just replace this statement by display and then simply pass name variable. 26 00:01:38,530 --> 00:01:44,440 So when this statement will be executed in the runtime this de-value which is present here will fall 27 00:01:44,500 --> 00:01:48,970 here and henceforth it will be printed inside their display method. 28 00:01:48,970 --> 00:01:51,110 Let us know what an hour called. 29 00:01:51,360 --> 00:01:54,610 So here we get Steve in the output console. 30 00:01:54,810 --> 00:01:55,890 Pretty simple. 31 00:01:55,950 --> 00:02:01,200 Now instead of this function suppose if I wanted to create a class and build this function within that 32 00:02:01,200 --> 00:02:02,900 class then how to do it. 33 00:02:02,910 --> 00:02:09,210 So for that what they really do here on the side I would simply create my class class space like say 34 00:02:09,210 --> 00:02:13,970 person followed by Bakker's open and close and insert this class of person. 35 00:02:13,980 --> 00:02:20,670 I would simply call this method from here and pasted within this person class plus now to access this 36 00:02:20,670 --> 00:02:26,950 method we have to clear the object of this class person as we all are aware of this right. 37 00:02:27,330 --> 00:02:29,700 So here let us remove all discord. 38 00:02:29,940 --> 00:02:31,740 So here what they will do here. 39 00:02:31,740 --> 00:02:42,300 I will simply create Let's see VAD space but isn't large the object equal to person. 40 00:02:42,430 --> 00:02:48,040 Now if you notice in case of Cartland we don't have any new keyword compared to Java. 41 00:02:48,170 --> 00:02:52,230 There we used to use the new keyword to create an object right. 42 00:02:52,340 --> 00:02:56,370 So this will simply create the new object of that type of person. 43 00:02:56,660 --> 00:03:05,720 And now don't decide you can simply access this display method by using an object d'art display right 44 00:03:06,080 --> 00:03:08,490 and then simply pass name as update. 45 00:03:08,750 --> 00:03:10,390 And now then we will render code. 46 00:03:10,430 --> 00:03:17,060 Then when the statement will be executed this function will be called as inside the class person and 47 00:03:17,060 --> 00:03:19,050 hence this will be executed. 48 00:03:19,050 --> 00:03:21,770 Now it will simply display Steve in the output. 49 00:03:21,770 --> 00:03:24,530 So let us know what an hour code. 50 00:03:24,540 --> 00:03:27,570 So here again we get Steve in the output. 51 00:03:27,570 --> 00:03:29,470 Now let us genderless more. 52 00:03:29,520 --> 00:03:34,920 Now suppose I've worn this name variable to be defined inside the class person. 53 00:03:34,920 --> 00:03:37,490 So the syntax is very simple. 54 00:03:37,530 --> 00:03:45,110 Here again let us define that space name followed by a clone of their type of string. 55 00:03:45,240 --> 00:03:48,870 So we defined the name variable of the type of string right. 56 00:03:49,070 --> 00:03:53,700 And now here it says the property must be initialized or be abstract. 57 00:03:53,810 --> 00:03:59,160 Let us give the initial value of let's see a blank string and now add that up. 58 00:03:59,160 --> 00:04:03,790 Let us remove these two lines of code and then more then we do is. 59 00:04:03,800 --> 00:04:10,360 I will simply remove again this line of code and then use Berzon object dord. 60 00:04:10,430 --> 00:04:14,840 Let's see Neame equal to Steve. 61 00:04:15,150 --> 00:04:22,410 But I now suppose if H is this that to well then it will simply show this error here because the value 62 00:04:22,410 --> 00:04:24,130 of this name cannot be changed. 63 00:04:24,210 --> 00:04:26,560 If we are using the Val keyword. 64 00:04:26,910 --> 00:04:27,620 Right. 65 00:04:27,660 --> 00:04:29,350 So always remember this. 66 00:04:29,520 --> 00:04:31,630 So let us change it back to that. 67 00:04:31,950 --> 00:04:33,770 And now the name becomes Steve. 68 00:04:33,960 --> 00:04:34,710 Now here. 69 00:04:34,800 --> 00:04:40,860 Very rarely do we simply call their display metrics person object guard display and simply pass name 70 00:04:40,890 --> 00:04:42,320 as paramita. 71 00:04:42,480 --> 00:04:47,950 But here this name should be used with the help of person object dog name. 72 00:04:48,120 --> 00:04:51,620 And now let us run the code so the output. 73 00:04:51,630 --> 00:04:54,080 Again we get Steve here. 74 00:04:54,170 --> 00:04:57,680 Right so our code is now working perfectly fine. 75 00:04:57,870 --> 00:05:05,370 Now what if I tell you that instead of passing the name here to simply remove this from here and now. 76 00:05:05,460 --> 00:05:09,660 Also let us remove this display method from here and now here. 77 00:05:09,870 --> 00:05:15,480 Let us print this name which is actually this name present here which is actually the field variable 78 00:05:15,570 --> 00:05:17,950 of the class of person right. 79 00:05:18,090 --> 00:05:19,730 So let us know what an hour. 80 00:05:19,920 --> 00:05:21,850 So again Steve in the output. 81 00:05:21,870 --> 00:05:28,080 So everything is working perfectly fine and this video is just meant to make you more comfortable with 82 00:05:28,080 --> 00:05:29,640 the Cartland language. 83 00:05:29,640 --> 00:05:34,770 We will explore each and every concept in detail in our upcoming mortuis so please don't worry about 84 00:05:34,770 --> 00:05:35,130 it. 85 00:05:35,190 --> 00:05:41,470 If you are unable to understand some concepts right in this video. 86 00:05:41,640 --> 00:05:43,740 And now let's try something different. 87 00:05:43,740 --> 00:05:44,620 Let us do one thing. 88 00:05:44,620 --> 00:05:49,700 Let us remove this Metford display and now they really do is suppose here. 89 00:05:49,770 --> 00:05:53,180 I want to print the Steve name inserted the main method. 90 00:05:53,220 --> 00:05:56,190 So for that I will simply use the print method. 91 00:05:56,370 --> 00:06:05,490 And then I will simply use the name of the person is your space and then use this symbol and then simply 92 00:06:05,490 --> 00:06:06,940 use it as an object. 93 00:06:06,970 --> 00:06:11,570 Don't mean and then simply then the called. 94 00:06:11,690 --> 00:06:16,070 So in the output we get the person the name of the person is Steve. 95 00:06:16,090 --> 00:06:16,750 Right. 96 00:06:17,120 --> 00:06:22,870 And now this is the usual syntax that I have followed here which is also being followed in case of Java 97 00:06:22,880 --> 00:06:25,360 C programming or C++ programming. 98 00:06:25,500 --> 00:06:30,830 Now in Scotland we have the concept of string in the Appalachian there what you will do. 99 00:06:30,860 --> 00:06:36,290 You can simply code it from here and pasted within the double called. 100 00:06:36,400 --> 00:06:43,180 And now to make the compiler understand that we have to extract the value out of this name variable. 101 00:06:43,180 --> 00:06:47,500 So for that we have to simply use the curly brackets here. 102 00:06:47,830 --> 00:06:53,380 And also here and then use the Dollar Sign here. 103 00:06:53,770 --> 00:06:59,570 So this will simply make the compiler understand that he has to extract the value from the person object 104 00:06:59,570 --> 00:07:02,630 d'art name and put it right within the codes. 105 00:07:02,650 --> 00:07:05,680 So let us note in our code. 106 00:07:05,890 --> 00:07:10,040 So here again Vigurs the output the name of the person is Steve. 107 00:07:10,140 --> 00:07:16,510 But I suppose if I remove the curly bracket from here and also from here then the compiler will simply 108 00:07:16,510 --> 00:07:22,680 understand that this string interpolation has been applied to this object not this name. 109 00:07:22,720 --> 00:07:23,340 Right. 110 00:07:23,380 --> 00:07:24,240 So let us know. 111 00:07:24,300 --> 00:07:26,800 And the code and see the output. 112 00:07:26,810 --> 00:07:31,650 So here we get something weird output person or something like that. 113 00:07:31,700 --> 00:07:32,660 Daut name. 114 00:07:32,780 --> 00:07:38,490 So the compiler simply understand that you have to give the value for this person object. 115 00:07:38,660 --> 00:07:42,400 This is actually just basically the address of this person object. 116 00:07:42,410 --> 00:07:50,420 So here make sure you always use the curly bracket open and close the end to print the value of name 117 00:07:50,420 --> 00:07:51,270 in the output. 118 00:07:51,360 --> 00:07:51,620 Right.